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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
126,500 | ligato/cn-infra | logging/logrus/logger.go | WithFields | func (logger *Logger) WithFields(fields logging.Fields) logging.LogWithLevel {
return logger.withFields(fields, 1)
} | go | func (logger *Logger) WithFields(fields logging.Fields) logging.LogWithLevel {
return logger.withFields(fields, 1)
} | [
"func",
"(",
"logger",
"*",
"Logger",
")",
"WithFields",
"(",
"fields",
"logging",
".",
"Fields",
")",
"logging",
".",
"LogWithLevel",
"{",
"return",
"logger",
".",
"withFields",
"(",
"fields",
",",
"1",
")",
"\n",
"}"
] | // WithFields creates an entry from the standard logger and adds multiple
// fields to it. This is simply a helper for `WithField`, invoking it
// once for each field.
//
// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal
// or Panic on the LogMsg it returns. | [
"WithFields",
"creates",
"an",
"entry",
"from",
"the",
"standard",
"logger",
"and",
"adds",
"multiple",
"fields",
"to",
"it",
".",
"This",
"is",
"simply",
"a",
"helper",
"for",
"WithField",
"invoking",
"it",
"once",
"for",
"each",
"field",
".",
"Note",
"th... | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/logging/logrus/logger.go#L290-L292 |
126,501 | ligato/cn-infra | logging/logrus/logger.go | Infoln | func (logger *Logger) Infoln(args ...interface{}) {
if logger.std.Level >= lg.InfoLevel {
logger.header(1).Infoln(args...)
}
} | go | func (logger *Logger) Infoln(args ...interface{}) {
if logger.std.Level >= lg.InfoLevel {
logger.header(1).Infoln(args...)
}
} | [
"func",
"(",
"logger",
"*",
"Logger",
")",
"Infoln",
"(",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"logger",
".",
"std",
".",
"Level",
">=",
"lg",
".",
"InfoLevel",
"{",
"logger",
".",
"header",
"(",
"1",
")",
".",
"Infoln",
"(",
"ar... | // Infoln logs a message at level Info on the standard logger. | [
"Infoln",
"logs",
"a",
"message",
"at",
"level",
"Info",
"on",
"the",
"standard",
"logger",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/logging/logrus/logger.go#L452-L456 |
126,502 | ligato/cn-infra | processmanager/template/template.go | NewTemplateReader | func NewTemplateReader(path string, log logging.Logger) (*Reader, error) {
reader := &Reader{
log: log,
path: path,
}
if _, err := os.Stat(path); os.IsNotExist(err) {
if err := os.MkdirAll(path, DefaultMode); err != nil {
return nil, errors.Errorf("cannot initialize template reader: path processing error:... | go | func NewTemplateReader(path string, log logging.Logger) (*Reader, error) {
reader := &Reader{
log: log,
path: path,
}
if _, err := os.Stat(path); os.IsNotExist(err) {
if err := os.MkdirAll(path, DefaultMode); err != nil {
return nil, errors.Errorf("cannot initialize template reader: path processing error:... | [
"func",
"NewTemplateReader",
"(",
"path",
"string",
",",
"log",
"logging",
".",
"Logger",
")",
"(",
"*",
"Reader",
",",
"error",
")",
"{",
"reader",
":=",
"&",
"Reader",
"{",
"log",
":",
"log",
",",
"path",
":",
"path",
",",
"}",
"\n\n",
"if",
"_",... | // NewTemplateReader returns a new instance of template reader with given path. The path is also verified and
// crated if not existed | [
"NewTemplateReader",
"returns",
"a",
"new",
"instance",
"of",
"template",
"reader",
"with",
"given",
"path",
".",
"The",
"path",
"is",
"also",
"verified",
"and",
"crated",
"if",
"not",
"existed"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/processmanager/template/template.go#L45-L57 |
126,503 | ligato/cn-infra | processmanager/template/template.go | GetAllTemplates | func (r *Reader) GetAllTemplates() ([]*process.Template, error) {
var templates []*process.Template
entries, err := ioutil.ReadDir(r.path)
if err != nil {
return templates, errors.Errorf("failed to open process template path %s: %v", r.path, err)
}
// From this point, log all errors bot continue reading
for _, ... | go | func (r *Reader) GetAllTemplates() ([]*process.Template, error) {
var templates []*process.Template
entries, err := ioutil.ReadDir(r.path)
if err != nil {
return templates, errors.Errorf("failed to open process template path %s: %v", r.path, err)
}
// From this point, log all errors bot continue reading
for _, ... | [
"func",
"(",
"r",
"*",
"Reader",
")",
"GetAllTemplates",
"(",
")",
"(",
"[",
"]",
"*",
"process",
".",
"Template",
",",
"error",
")",
"{",
"var",
"templates",
"[",
"]",
"*",
"process",
".",
"Template",
"\n",
"entries",
",",
"err",
":=",
"ioutil",
"... | // GetAllTemplates reads all templates from reader's path. Error is returned if path is not a directory. All JSON
// file are read and un-marshaled as template objects | [
"GetAllTemplates",
"reads",
"all",
"templates",
"from",
"reader",
"s",
"path",
".",
"Error",
"is",
"returned",
"if",
"path",
"is",
"not",
"a",
"directory",
".",
"All",
"JSON",
"file",
"are",
"read",
"and",
"un",
"-",
"marshaled",
"as",
"template",
"objects... | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/processmanager/template/template.go#L61-L93 |
126,504 | ligato/cn-infra | db/keyval/filedb/decoder/decoder_json.go | Encode | func (jd *JSONDecoder) Encode(data []*FileDataEntry) ([]byte, error) {
// Convert to json-specific structure
var jsonFileEntries []jsonFileEntry
for _, dataEntry := range data {
jsonFileEntries = append(jsonFileEntries, jsonFileEntry{
Key: dataEntry.Key,
Value: dataEntry.Value,
})
}
// Encode to type s... | go | func (jd *JSONDecoder) Encode(data []*FileDataEntry) ([]byte, error) {
// Convert to json-specific structure
var jsonFileEntries []jsonFileEntry
for _, dataEntry := range data {
jsonFileEntries = append(jsonFileEntries, jsonFileEntry{
Key: dataEntry.Key,
Value: dataEntry.Value,
})
}
// Encode to type s... | [
"func",
"(",
"jd",
"*",
"JSONDecoder",
")",
"Encode",
"(",
"data",
"[",
"]",
"*",
"FileDataEntry",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"// Convert to json-specific structure",
"var",
"jsonFileEntries",
"[",
"]",
"jsonFileEntry",
"\n",
"for",
... | // Encode provided file entries into JSON byte set | [
"Encode",
"provided",
"file",
"entries",
"into",
"JSON",
"byte",
"set"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/filedb/decoder/decoder_json.go#L61-L73 |
126,505 | ligato/cn-infra | db/keyval/filedb/decoder/decoder_json.go | Decode | func (jd *JSONDecoder) Decode(byteSet []byte) ([]*FileDataEntry, error) {
if len(byteSet) == 0 {
return []*FileDataEntry{}, nil
}
// Decode to type-specific structure
jsonFile := jsonFile{}
err := json.Unmarshal(byteSet, &jsonFile)
if err != nil {
return nil, fmt.Errorf("failed to decode json file: %v", err)
... | go | func (jd *JSONDecoder) Decode(byteSet []byte) ([]*FileDataEntry, error) {
if len(byteSet) == 0 {
return []*FileDataEntry{}, nil
}
// Decode to type-specific structure
jsonFile := jsonFile{}
err := json.Unmarshal(byteSet, &jsonFile)
if err != nil {
return nil, fmt.Errorf("failed to decode json file: %v", err)
... | [
"func",
"(",
"jd",
"*",
"JSONDecoder",
")",
"Decode",
"(",
"byteSet",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"*",
"FileDataEntry",
",",
"error",
")",
"{",
"if",
"len",
"(",
"byteSet",
")",
"==",
"0",
"{",
"return",
"[",
"]",
"*",
"FileDataEntry",
... | // Decode provided byte set of json file and returns set of file data entries | [
"Decode",
"provided",
"byte",
"set",
"of",
"json",
"file",
"and",
"returns",
"set",
"of",
"file",
"data",
"entries"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/filedb/decoder/decoder_json.go#L76-L92 |
126,506 | ligato/cn-infra | messaging/kafka/mux/config.go | ConfigFromFile | func ConfigFromFile(fpath string) (*Config, error) {
cfg := &Config{}
err := config.ParseConfigFromYamlFile(fpath, cfg)
if err != nil {
return nil, err
}
return cfg, err
} | go | func ConfigFromFile(fpath string) (*Config, error) {
cfg := &Config{}
err := config.ParseConfigFromYamlFile(fpath, cfg)
if err != nil {
return nil, err
}
return cfg, err
} | [
"func",
"ConfigFromFile",
"(",
"fpath",
"string",
")",
"(",
"*",
"Config",
",",
"error",
")",
"{",
"cfg",
":=",
"&",
"Config",
"{",
"}",
"\n",
"err",
":=",
"config",
".",
"ParseConfigFromYamlFile",
"(",
"fpath",
",",
"cfg",
")",
"\n",
"if",
"err",
"!... | // ConfigFromFile loads the Kafka multiplexer configuration from the
// specified file. If the specified file is valid and contains
// valid configuration, the parsed configuration is
// returned; otherwise, an error is returned. | [
"ConfigFromFile",
"loads",
"the",
"Kafka",
"multiplexer",
"configuration",
"from",
"the",
"specified",
"file",
".",
"If",
"the",
"specified",
"file",
"is",
"valid",
"and",
"contains",
"valid",
"configuration",
"the",
"parsed",
"configuration",
"is",
"returned",
";... | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/mux/config.go#L40-L47 |
126,507 | ligato/cn-infra | messaging/kafka/mux/config.go | InitMultiplexer | func InitMultiplexer(configFile string, name string, log logging.Logger) (*Multiplexer, error) {
var err error
var tls clienttls.TLS
cfg := &Config{[]string{DefAddress}, "", tls}
if configFile != "" {
cfg, err = ConfigFromFile(configFile)
if err != nil {
return nil, err
}
}
// prepare client config
cli... | go | func InitMultiplexer(configFile string, name string, log logging.Logger) (*Multiplexer, error) {
var err error
var tls clienttls.TLS
cfg := &Config{[]string{DefAddress}, "", tls}
if configFile != "" {
cfg, err = ConfigFromFile(configFile)
if err != nil {
return nil, err
}
}
// prepare client config
cli... | [
"func",
"InitMultiplexer",
"(",
"configFile",
"string",
",",
"name",
"string",
",",
"log",
"logging",
".",
"Logger",
")",
"(",
"*",
"Multiplexer",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n",
"var",
"tls",
"clienttls",
".",
"TLS",
"\n",
"cfg",
... | // InitMultiplexer initialize and returns new kafka multiplexer based on the supplied config file.
// Name is used as groupId identification of consumer. Kafka allows to store last read offset for
// a groupId. This is leveraged to deliver unread messages after restart. | [
"InitMultiplexer",
"initialize",
"and",
"returns",
"new",
"kafka",
"multiplexer",
"based",
"on",
"the",
"supplied",
"config",
"file",
".",
"Name",
"is",
"used",
"as",
"groupId",
"identification",
"of",
"consumer",
".",
"Kafka",
"allows",
"to",
"store",
"last",
... | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/mux/config.go#L64-L104 |
126,508 | ligato/cn-infra | messaging/kafka/mux/config.go | InitMultiplexerWithConfig | func InitMultiplexerWithConfig(clientCfg *client.Config, hsClient sarama.Client, manClient sarama.Client, name string, log logging.Logger) (*Multiplexer, error) {
const errorFmt = "Failed to create Kafka %s, Configured broker(s) %v, Error: '%s'"
log.WithField("addrs", hsClient.Brokers()).Debug("Kafka connecting")
... | go | func InitMultiplexerWithConfig(clientCfg *client.Config, hsClient sarama.Client, manClient sarama.Client, name string, log logging.Logger) (*Multiplexer, error) {
const errorFmt = "Failed to create Kafka %s, Configured broker(s) %v, Error: '%s'"
log.WithField("addrs", hsClient.Brokers()).Debug("Kafka connecting")
... | [
"func",
"InitMultiplexerWithConfig",
"(",
"clientCfg",
"*",
"client",
".",
"Config",
",",
"hsClient",
"sarama",
".",
"Client",
",",
"manClient",
"sarama",
".",
"Client",
",",
"name",
"string",
",",
"log",
"logging",
".",
"Logger",
")",
"(",
"*",
"Multiplexer... | // InitMultiplexerWithConfig initialize and returns new kafka multiplexer based on the supplied mux configuration.
// Name is used as groupId identification of consumer. Kafka allows to store last read offset for a groupId.
// This is leveraged to deliver unread messages after restart. | [
"InitMultiplexerWithConfig",
"initialize",
"and",
"returns",
"new",
"kafka",
"multiplexer",
"based",
"on",
"the",
"supplied",
"mux",
"configuration",
".",
"Name",
"is",
"used",
"as",
"groupId",
"identification",
"of",
"consumer",
".",
"Kafka",
"allows",
"to",
"sto... | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/mux/config.go#L109-L153 |
126,509 | ligato/cn-infra | examples/consul-lib/main.go | listKeys | func listKeys(db keyval.ProtoBroker) {
resp, err := db.ListKeys(phonebook.EtcdPath())
if err != nil {
log.Fatal(err)
}
fmt.Println("list keys:")
for {
key, _, stop := resp.GetNext()
if stop {
break
}
fmt.Printf("- %s\n", key)
}
} | go | func listKeys(db keyval.ProtoBroker) {
resp, err := db.ListKeys(phonebook.EtcdPath())
if err != nil {
log.Fatal(err)
}
fmt.Println("list keys:")
for {
key, _, stop := resp.GetNext()
if stop {
break
}
fmt.Printf("- %s\n", key)
}
} | [
"func",
"listKeys",
"(",
"db",
"keyval",
".",
"ProtoBroker",
")",
"{",
"resp",
",",
"err",
":=",
"db",
".",
"ListKeys",
"(",
"phonebook",
".",
"EtcdPath",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Fatal",
"(",
"err",
")",
"... | // listKeys lists keys | [
"listKeys",
"lists",
"keys"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/examples/consul-lib/main.go#L53-L69 |
126,510 | ligato/cn-infra | examples/consul-lib/main.go | list | func list(db keyval.ProtoBroker) {
resp, err := db.ListValues(phonebook.EtcdPath())
if err != nil {
log.Fatal(err)
}
var revision int64
fmt.Println("list values:")
for {
c := &phonebook.Contact{}
kv, stop := resp.GetNext()
if stop {
break
}
if kv.GetRevision() > revision {
revision = kv.GetRevi... | go | func list(db keyval.ProtoBroker) {
resp, err := db.ListValues(phonebook.EtcdPath())
if err != nil {
log.Fatal(err)
}
var revision int64
fmt.Println("list values:")
for {
c := &phonebook.Contact{}
kv, stop := resp.GetNext()
if stop {
break
}
if kv.GetRevision() > revision {
revision = kv.GetRevi... | [
"func",
"list",
"(",
"db",
"keyval",
".",
"ProtoBroker",
")",
"{",
"resp",
",",
"err",
":=",
"db",
".",
"ListValues",
"(",
"phonebook",
".",
"EtcdPath",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Fatal",
"(",
"err",
")",
"\n... | // list lists keys with values | [
"list",
"lists",
"keys",
"with",
"values"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/examples/consul-lib/main.go#L72-L98 |
126,511 | ligato/cn-infra | examples/consul-lib/main.go | put | func put(db keyval.ProtoBroker, data []string) {
c := &phonebook.Contact{Name: data[0], Company: data[1], Phonenumber: data[2]}
key := phonebook.EtcdContactPath(c)
err := db.Put(key, c)
if err != nil {
log.Fatal(err)
}
fmt.Println("Saved:", key)
} | go | func put(db keyval.ProtoBroker, data []string) {
c := &phonebook.Contact{Name: data[0], Company: data[1], Phonenumber: data[2]}
key := phonebook.EtcdContactPath(c)
err := db.Put(key, c)
if err != nil {
log.Fatal(err)
}
fmt.Println("Saved:", key)
} | [
"func",
"put",
"(",
"db",
"keyval",
".",
"ProtoBroker",
",",
"data",
"[",
"]",
"string",
")",
"{",
"c",
":=",
"&",
"phonebook",
".",
"Contact",
"{",
"Name",
":",
"data",
"[",
"0",
"]",
",",
"Company",
":",
"data",
"[",
"1",
"]",
",",
"Phonenumber... | // put saves single entry | [
"put",
"saves",
"single",
"entry"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/examples/consul-lib/main.go#L101-L112 |
126,512 | ligato/cn-infra | examples/consul-lib/main.go | get | func get(db keyval.ProtoBroker, data string) {
c := &phonebook.Contact{Name: data}
key := phonebook.EtcdContactPath(c)
found, _, err := db.GetValue(key, c)
if err != nil {
log.Fatal(err)
} else if !found {
fmt.Println("Not found")
return
}
fmt.Println("Loaded:", key, c)
} | go | func get(db keyval.ProtoBroker, data string) {
c := &phonebook.Contact{Name: data}
key := phonebook.EtcdContactPath(c)
found, _, err := db.GetValue(key, c)
if err != nil {
log.Fatal(err)
} else if !found {
fmt.Println("Not found")
return
}
fmt.Println("Loaded:", key, c)
} | [
"func",
"get",
"(",
"db",
"keyval",
".",
"ProtoBroker",
",",
"data",
"string",
")",
"{",
"c",
":=",
"&",
"phonebook",
".",
"Contact",
"{",
"Name",
":",
"data",
"}",
"\n\n",
"key",
":=",
"phonebook",
".",
"EtcdContactPath",
"(",
"c",
")",
"\n\n",
"fou... | // get retrieves single entry | [
"get",
"retrieves",
"single",
"entry"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/examples/consul-lib/main.go#L115-L129 |
126,513 | ligato/cn-infra | examples/consul-lib/main.go | del | func del(db keyval.ProtoBroker, data string) {
c := &phonebook.Contact{Name: data}
key := phonebook.EtcdContactPath(c)
existed, err := db.Delete(key)
if err != nil {
log.Fatal(err)
} else if !existed {
fmt.Println("Not existed")
return
}
fmt.Println("Deleted:", key)
} | go | func del(db keyval.ProtoBroker, data string) {
c := &phonebook.Contact{Name: data}
key := phonebook.EtcdContactPath(c)
existed, err := db.Delete(key)
if err != nil {
log.Fatal(err)
} else if !existed {
fmt.Println("Not existed")
return
}
fmt.Println("Deleted:", key)
} | [
"func",
"del",
"(",
"db",
"keyval",
".",
"ProtoBroker",
",",
"data",
"string",
")",
"{",
"c",
":=",
"&",
"phonebook",
".",
"Contact",
"{",
"Name",
":",
"data",
"}",
"\n\n",
"key",
":=",
"phonebook",
".",
"EtcdContactPath",
"(",
"c",
")",
"\n\n",
"exi... | // del deletes single entry | [
"del",
"deletes",
"single",
"entry"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/examples/consul-lib/main.go#L132-L146 |
126,514 | ligato/cn-infra | messaging/kafka/client/syncproducer.go | SendMsgByte | func (ref *SyncProducer) SendMsgByte(topic string, key []byte, msg []byte) (*ProducerMessage, error) {
// generate a key if none supplied (used by hash partitioner)
ref.WithFields(logging.Fields{"key": key, "msg": msg}).Debug("Sending")
if key == nil || len(key) == 0 {
md5Sum := fmt.Sprintf("%x", md5.Sum(msg))
... | go | func (ref *SyncProducer) SendMsgByte(topic string, key []byte, msg []byte) (*ProducerMessage, error) {
// generate a key if none supplied (used by hash partitioner)
ref.WithFields(logging.Fields{"key": key, "msg": msg}).Debug("Sending")
if key == nil || len(key) == 0 {
md5Sum := fmt.Sprintf("%x", md5.Sum(msg))
... | [
"func",
"(",
"ref",
"*",
"SyncProducer",
")",
"SendMsgByte",
"(",
"topic",
"string",
",",
"key",
"[",
"]",
"byte",
",",
"msg",
"[",
"]",
"byte",
")",
"(",
"*",
"ProducerMessage",
",",
"error",
")",
"{",
"// generate a key if none supplied (used by hash partiti... | // SendMsgByte sends a message to Kafka | [
"SendMsgByte",
"sends",
"a",
"message",
"to",
"Kafka"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/client/syncproducer.go#L142-L151 |
126,515 | ligato/cn-infra | messaging/kafka/client/syncproducer.go | SendMsgToPartition | func (ref *SyncProducer) SendMsgToPartition(topic string, partition int32, key sarama.Encoder, msg sarama.Encoder) (*ProducerMessage, error) {
if msg == nil {
err := errors.New("nil message can not be sent")
ref.Error(err)
return nil, err
}
message := &sarama.ProducerMessage{
Topic: topic,
Partition: p... | go | func (ref *SyncProducer) SendMsgToPartition(topic string, partition int32, key sarama.Encoder, msg sarama.Encoder) (*ProducerMessage, error) {
if msg == nil {
err := errors.New("nil message can not be sent")
ref.Error(err)
return nil, err
}
message := &sarama.ProducerMessage{
Topic: topic,
Partition: p... | [
"func",
"(",
"ref",
"*",
"SyncProducer",
")",
"SendMsgToPartition",
"(",
"topic",
"string",
",",
"partition",
"int32",
",",
"key",
"sarama",
".",
"Encoder",
",",
"msg",
"sarama",
".",
"Encoder",
")",
"(",
"*",
"ProducerMessage",
",",
"error",
")",
"{",
"... | // SendMsgToPartition sends a message to Kafka | [
"SendMsgToPartition",
"sends",
"a",
"message",
"to",
"Kafka"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/client/syncproducer.go#L154-L182 |
126,516 | ligato/cn-infra | messaging/kafka/client/syncproducer.go | setProducerRequiredAcks | func setProducerRequiredAcks(cfg *Config) error {
switch cfg.RequiredAcks {
case NoResponse:
cfg.ProducerConfig().Producer.RequiredAcks = sarama.NoResponse
return nil
case WaitForLocal:
cfg.ProducerConfig().Producer.RequiredAcks = sarama.WaitForLocal
return nil
case WaitForAll:
cfg.ProducerConfig().Produc... | go | func setProducerRequiredAcks(cfg *Config) error {
switch cfg.RequiredAcks {
case NoResponse:
cfg.ProducerConfig().Producer.RequiredAcks = sarama.NoResponse
return nil
case WaitForLocal:
cfg.ProducerConfig().Producer.RequiredAcks = sarama.WaitForLocal
return nil
case WaitForAll:
cfg.ProducerConfig().Produc... | [
"func",
"setProducerRequiredAcks",
"(",
"cfg",
"*",
"Config",
")",
"error",
"{",
"switch",
"cfg",
".",
"RequiredAcks",
"{",
"case",
"NoResponse",
":",
"cfg",
".",
"ProducerConfig",
"(",
")",
".",
"Producer",
".",
"RequiredAcks",
"=",
"sarama",
".",
"NoRespon... | // setProducerRequiredAcks set the RequiredAcks field for a producer | [
"setProducerRequiredAcks",
"set",
"the",
"RequiredAcks",
"field",
"for",
"a",
"producer"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/client/syncproducer.go#L185-L199 |
126,517 | ligato/cn-infra | messaging/kafka/mux/proto_connection.go | NewSyncPublisher | func (conn *ProtoConnection) NewSyncPublisher(topic string) (messaging.ProtoPublisher, error) {
return &protoSyncPublisherKafka{conn, topic}, nil
} | go | func (conn *ProtoConnection) NewSyncPublisher(topic string) (messaging.ProtoPublisher, error) {
return &protoSyncPublisherKafka{conn, topic}, nil
} | [
"func",
"(",
"conn",
"*",
"ProtoConnection",
")",
"NewSyncPublisher",
"(",
"topic",
"string",
")",
"(",
"messaging",
".",
"ProtoPublisher",
",",
"error",
")",
"{",
"return",
"&",
"protoSyncPublisherKafka",
"{",
"conn",
",",
"topic",
"}",
",",
"nil",
"\n",
... | // NewSyncPublisher creates a new instance of protoSyncPublisherKafka that allows to publish sync kafka messages using common messaging API | [
"NewSyncPublisher",
"creates",
"a",
"new",
"instance",
"of",
"protoSyncPublisherKafka",
"that",
"allows",
"to",
"publish",
"sync",
"kafka",
"messages",
"using",
"common",
"messaging",
"API"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/mux/proto_connection.go#L81-L83 |
126,518 | ligato/cn-infra | messaging/kafka/mux/proto_connection.go | NewAsyncPublisher | func (conn *ProtoConnection) NewAsyncPublisher(topic string, successClb func(messaging.ProtoMessage), errorClb func(messaging.ProtoMessageErr)) (messaging.ProtoPublisher, error) {
return &protoAsyncPublisherKafka{conn, topic, successClb, errorClb}, nil
} | go | func (conn *ProtoConnection) NewAsyncPublisher(topic string, successClb func(messaging.ProtoMessage), errorClb func(messaging.ProtoMessageErr)) (messaging.ProtoPublisher, error) {
return &protoAsyncPublisherKafka{conn, topic, successClb, errorClb}, nil
} | [
"func",
"(",
"conn",
"*",
"ProtoConnection",
")",
"NewAsyncPublisher",
"(",
"topic",
"string",
",",
"successClb",
"func",
"(",
"messaging",
".",
"ProtoMessage",
")",
",",
"errorClb",
"func",
"(",
"messaging",
".",
"ProtoMessageErr",
")",
")",
"(",
"messaging",... | // NewAsyncPublisher creates a new instance of protoAsyncPublisherKafka that allows to publish sync kafka messages using common messaging API | [
"NewAsyncPublisher",
"creates",
"a",
"new",
"instance",
"of",
"protoAsyncPublisherKafka",
"that",
"allows",
"to",
"publish",
"sync",
"kafka",
"messages",
"using",
"common",
"messaging",
"API"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/mux/proto_connection.go#L86-L88 |
126,519 | ligato/cn-infra | messaging/kafka/mux/proto_connection.go | NewSyncPublisherToPartition | func (conn *ProtoManualConnection) NewSyncPublisherToPartition(topic string, partition int32) (messaging.ProtoPublisher, error) {
return &protoManualSyncPublisherKafka{conn, topic, partition}, nil
} | go | func (conn *ProtoManualConnection) NewSyncPublisherToPartition(topic string, partition int32) (messaging.ProtoPublisher, error) {
return &protoManualSyncPublisherKafka{conn, topic, partition}, nil
} | [
"func",
"(",
"conn",
"*",
"ProtoManualConnection",
")",
"NewSyncPublisherToPartition",
"(",
"topic",
"string",
",",
"partition",
"int32",
")",
"(",
"messaging",
".",
"ProtoPublisher",
",",
"error",
")",
"{",
"return",
"&",
"protoManualSyncPublisherKafka",
"{",
"co... | // NewSyncPublisherToPartition creates a new instance of protoManualSyncPublisherKafka that allows to publish sync kafka messages using common messaging API | [
"NewSyncPublisherToPartition",
"creates",
"a",
"new",
"instance",
"of",
"protoManualSyncPublisherKafka",
"that",
"allows",
"to",
"publish",
"sync",
"kafka",
"messages",
"using",
"common",
"messaging",
"API"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/mux/proto_connection.go#L91-L93 |
126,520 | ligato/cn-infra | messaging/kafka/mux/proto_connection.go | NewAsyncPublisherToPartition | func (conn *ProtoManualConnection) NewAsyncPublisherToPartition(topic string, partition int32, successClb func(messaging.ProtoMessage), errorClb func(messaging.ProtoMessageErr)) (messaging.ProtoPublisher, error) {
return &protoManualAsyncPublisherKafka{conn, topic, partition, successClb, errorClb}, nil
} | go | func (conn *ProtoManualConnection) NewAsyncPublisherToPartition(topic string, partition int32, successClb func(messaging.ProtoMessage), errorClb func(messaging.ProtoMessageErr)) (messaging.ProtoPublisher, error) {
return &protoManualAsyncPublisherKafka{conn, topic, partition, successClb, errorClb}, nil
} | [
"func",
"(",
"conn",
"*",
"ProtoManualConnection",
")",
"NewAsyncPublisherToPartition",
"(",
"topic",
"string",
",",
"partition",
"int32",
",",
"successClb",
"func",
"(",
"messaging",
".",
"ProtoMessage",
")",
",",
"errorClb",
"func",
"(",
"messaging",
".",
"Pro... | // NewAsyncPublisherToPartition creates a new instance of protoManualAsyncPublisherKafka that allows to publish sync kafka
// messages using common messaging API. | [
"NewAsyncPublisherToPartition",
"creates",
"a",
"new",
"instance",
"of",
"protoManualAsyncPublisherKafka",
"that",
"allows",
"to",
"publish",
"sync",
"kafka",
"messages",
"using",
"common",
"messaging",
"API",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/mux/proto_connection.go#L97-L99 |
126,521 | ligato/cn-infra | messaging/kafka/mux/proto_connection.go | Watch | func (conn *ProtoConnection) Watch(msgClb func(messaging.ProtoMessage), topics ...string) error {
return conn.ConsumeTopic(msgClb, topics...)
} | go | func (conn *ProtoConnection) Watch(msgClb func(messaging.ProtoMessage), topics ...string) error {
return conn.ConsumeTopic(msgClb, topics...)
} | [
"func",
"(",
"conn",
"*",
"ProtoConnection",
")",
"Watch",
"(",
"msgClb",
"func",
"(",
"messaging",
".",
"ProtoMessage",
")",
",",
"topics",
"...",
"string",
")",
"error",
"{",
"return",
"conn",
".",
"ConsumeTopic",
"(",
"msgClb",
",",
"topics",
"...",
"... | // Watch is an alias for ConsumeTopic method. The alias was added in order to conform to messaging.Mux interface. | [
"Watch",
"is",
"an",
"alias",
"for",
"ConsumeTopic",
"method",
".",
"The",
"alias",
"was",
"added",
"in",
"order",
"to",
"conform",
"to",
"messaging",
".",
"Mux",
"interface",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/mux/proto_connection.go#L102-L104 |
126,522 | ligato/cn-infra | messaging/kafka/mux/proto_connection.go | ConsumeTopic | func (conn *ProtoConnection) ConsumeTopic(msgClb func(messaging.ProtoMessage), topics ...string) error {
conn.multiplexer.rwlock.Lock()
defer conn.multiplexer.rwlock.Unlock()
if conn.multiplexer.started {
return fmt.Errorf("ConsumeTopic can be called only if the multiplexer has not been started yet")
}
byteClb... | go | func (conn *ProtoConnection) ConsumeTopic(msgClb func(messaging.ProtoMessage), topics ...string) error {
conn.multiplexer.rwlock.Lock()
defer conn.multiplexer.rwlock.Unlock()
if conn.multiplexer.started {
return fmt.Errorf("ConsumeTopic can be called only if the multiplexer has not been started yet")
}
byteClb... | [
"func",
"(",
"conn",
"*",
"ProtoConnection",
")",
"ConsumeTopic",
"(",
"msgClb",
"func",
"(",
"messaging",
".",
"ProtoMessage",
")",
",",
"topics",
"...",
"string",
")",
"error",
"{",
"conn",
".",
"multiplexer",
".",
"rwlock",
".",
"Lock",
"(",
")",
"\n"... | // ConsumeTopic is called to start consuming given topics.
// Function can be called until the multiplexer is started, it returns an error otherwise.
// The provided channel should be buffered, otherwise messages might be lost. | [
"ConsumeTopic",
"is",
"called",
"to",
"start",
"consuming",
"given",
"topics",
".",
"Function",
"can",
"be",
"called",
"until",
"the",
"multiplexer",
"is",
"started",
"it",
"returns",
"an",
"error",
"otherwise",
".",
"The",
"provided",
"channel",
"should",
"be... | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/mux/proto_connection.go#L109-L155 |
126,523 | ligato/cn-infra | messaging/kafka/mux/proto_connection.go | WatchPartition | func (conn *ProtoManualConnection) WatchPartition(msgClb func(messaging.ProtoMessage), topic string, partition int32, offset int64) error {
return conn.ConsumePartition(msgClb, topic, partition, offset)
} | go | func (conn *ProtoManualConnection) WatchPartition(msgClb func(messaging.ProtoMessage), topic string, partition int32, offset int64) error {
return conn.ConsumePartition(msgClb, topic, partition, offset)
} | [
"func",
"(",
"conn",
"*",
"ProtoManualConnection",
")",
"WatchPartition",
"(",
"msgClb",
"func",
"(",
"messaging",
".",
"ProtoMessage",
")",
",",
"topic",
"string",
",",
"partition",
"int32",
",",
"offset",
"int64",
")",
"error",
"{",
"return",
"conn",
".",
... | // WatchPartition is an alias for ConsumePartition method. The alias was added in order to conform to
// messaging.Mux interface. | [
"WatchPartition",
"is",
"an",
"alias",
"for",
"ConsumePartition",
"method",
".",
"The",
"alias",
"was",
"added",
"in",
"order",
"to",
"conform",
"to",
"messaging",
".",
"Mux",
"interface",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/mux/proto_connection.go#L159-L161 |
126,524 | ligato/cn-infra | messaging/kafka/mux/proto_connection.go | StopWatchPartition | func (conn *ProtoConnectionFields) StopWatchPartition(topic string, partition int32, offset int64) error {
return conn.StopConsumingPartition(topic, partition, offset)
} | go | func (conn *ProtoConnectionFields) StopWatchPartition(topic string, partition int32, offset int64) error {
return conn.StopConsumingPartition(topic, partition, offset)
} | [
"func",
"(",
"conn",
"*",
"ProtoConnectionFields",
")",
"StopWatchPartition",
"(",
"topic",
"string",
",",
"partition",
"int32",
",",
"offset",
"int64",
")",
"error",
"{",
"return",
"conn",
".",
"StopConsumingPartition",
"(",
"topic",
",",
"partition",
",",
"o... | // StopWatchPartition is an alias for StopConsumingPartition method. The alias was added in order to conform to messaging.Mux interface. | [
"StopWatchPartition",
"is",
"an",
"alias",
"for",
"StopConsumingPartition",
"method",
".",
"The",
"alias",
"was",
"added",
"in",
"order",
"to",
"conform",
"to",
"messaging",
".",
"Mux",
"interface",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/mux/proto_connection.go#L254-L256 |
126,525 | ligato/cn-infra | messaging/kafka/mux/proto_connection.go | StopConsumingPartition | func (conn *ProtoConnectionFields) StopConsumingPartition(topic string, partition int32, offset int64) error {
return conn.multiplexer.stopConsumingPartition(topic, partition, offset, conn.name)
} | go | func (conn *ProtoConnectionFields) StopConsumingPartition(topic string, partition int32, offset int64) error {
return conn.multiplexer.stopConsumingPartition(topic, partition, offset, conn.name)
} | [
"func",
"(",
"conn",
"*",
"ProtoConnectionFields",
")",
"StopConsumingPartition",
"(",
"topic",
"string",
",",
"partition",
"int32",
",",
"offset",
"int64",
")",
"error",
"{",
"return",
"conn",
".",
"multiplexer",
".",
"stopConsumingPartition",
"(",
"topic",
","... | // StopConsumingPartition cancels the previously created subscription for consuming the topic, partition and offset | [
"StopConsumingPartition",
"cancels",
"the",
"previously",
"created",
"subscription",
"for",
"consuming",
"the",
"topic",
"partition",
"and",
"offset"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/mux/proto_connection.go#L259-L261 |
126,526 | ligato/cn-infra | messaging/kafka/mux/proto_connection.go | sendSyncMessage | func (conn *ProtoConnectionFields) sendSyncMessage(topic string, partition int32, key string, value proto.Message, manualMode bool) (offset int64, err error) {
data, err := conn.serializer.Marshal(value)
if err != nil {
return 0, err
}
if manualMode {
msg, err := conn.multiplexer.manSyncProducer.SendMsgToParti... | go | func (conn *ProtoConnectionFields) sendSyncMessage(topic string, partition int32, key string, value proto.Message, manualMode bool) (offset int64, err error) {
data, err := conn.serializer.Marshal(value)
if err != nil {
return 0, err
}
if manualMode {
msg, err := conn.multiplexer.manSyncProducer.SendMsgToParti... | [
"func",
"(",
"conn",
"*",
"ProtoConnectionFields",
")",
"sendSyncMessage",
"(",
"topic",
"string",
",",
"partition",
"int32",
",",
"key",
"string",
",",
"value",
"proto",
".",
"Message",
",",
"manualMode",
"bool",
")",
"(",
"offset",
"int64",
",",
"err",
"... | // sendSyncMessage sends a message using the sync API. If manual mode is chosen, the appropriate producer will be used. | [
"sendSyncMessage",
"sends",
"a",
"message",
"using",
"the",
"sync",
"API",
".",
"If",
"manual",
"mode",
"is",
"chosen",
"the",
"appropriate",
"producer",
"will",
"be",
"used",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/mux/proto_connection.go#L310-L328 |
126,527 | ligato/cn-infra | messaging/kafka/mux/proto_connection.go | sendAsyncMessage | func (conn *ProtoConnectionFields) sendAsyncMessage(topic string, partition int32, key string, value proto.Message, manualMode bool,
meta interface{}, successClb func(messaging.ProtoMessage), errClb func(messaging.ProtoMessageErr)) error {
data, err := conn.serializer.Marshal(value)
if err != nil {
return err
}
... | go | func (conn *ProtoConnectionFields) sendAsyncMessage(topic string, partition int32, key string, value proto.Message, manualMode bool,
meta interface{}, successClb func(messaging.ProtoMessage), errClb func(messaging.ProtoMessageErr)) error {
data, err := conn.serializer.Marshal(value)
if err != nil {
return err
}
... | [
"func",
"(",
"conn",
"*",
"ProtoConnectionFields",
")",
"sendAsyncMessage",
"(",
"topic",
"string",
",",
"partition",
"int32",
",",
"key",
"string",
",",
"value",
"proto",
".",
"Message",
",",
"manualMode",
"bool",
",",
"meta",
"interface",
"{",
"}",
",",
... | // sendAsyncMessage sends a message using the async API. If manual mode is chosen, the appropriate producer will be used. | [
"sendAsyncMessage",
"sends",
"a",
"message",
"using",
"the",
"async",
"API",
".",
"If",
"manual",
"mode",
"is",
"chosen",
"the",
"appropriate",
"producer",
"will",
"be",
"used",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/mux/proto_connection.go#L331-L364 |
126,528 | ligato/cn-infra | rpc/grpc/auth.go | Authenticate | func (a Authenticator) Authenticate(ctx context.Context) (newCtx context.Context, err error) {
defer func() {
if err == nil {
// Store user metadata
userMD := &UserMetadata{
ID: a.Username,
}
newCtx = context.WithValue(newCtx, userMDKey{}, userMD)
}
}()
err = a.tryTLSAuth(ctx)
if err == nil {
... | go | func (a Authenticator) Authenticate(ctx context.Context) (newCtx context.Context, err error) {
defer func() {
if err == nil {
// Store user metadata
userMD := &UserMetadata{
ID: a.Username,
}
newCtx = context.WithValue(newCtx, userMDKey{}, userMD)
}
}()
err = a.tryTLSAuth(ctx)
if err == nil {
... | [
"func",
"(",
"a",
"Authenticator",
")",
"Authenticate",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"newCtx",
"context",
".",
"Context",
",",
"err",
"error",
")",
"{",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
"==",
"nil",
"{",
"// Store user m... | // Authenticate checks that a token exists and is valid. It stores the user
// metadata in the returned context and removes the token from the context. | [
"Authenticate",
"checks",
"that",
"a",
"token",
"exists",
"and",
"is",
"valid",
".",
"It",
"stores",
"the",
"user",
"metadata",
"in",
"the",
"returned",
"context",
"and",
"removes",
"the",
"token",
"from",
"the",
"context",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/rpc/grpc/auth.go#L38-L60 |
126,529 | ligato/cn-infra | rpc/grpc/auth.go | GetUserMetadata | func GetUserMetadata(ctx context.Context) (*UserMetadata, bool) {
userMD := ctx.Value(userMDKey{})
switch md := userMD.(type) {
case *UserMetadata:
return md, true
default:
return nil, false
}
} | go | func GetUserMetadata(ctx context.Context) (*UserMetadata, bool) {
userMD := ctx.Value(userMDKey{})
switch md := userMD.(type) {
case *UserMetadata:
return md, true
default:
return nil, false
}
} | [
"func",
"GetUserMetadata",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"UserMetadata",
",",
"bool",
")",
"{",
"userMD",
":=",
"ctx",
".",
"Value",
"(",
"userMDKey",
"{",
"}",
")",
"\n\n",
"switch",
"md",
":=",
"userMD",
".",
"(",
"type",
")... | // GetUserMetadata can be used to extract user metadata stored in a context. | [
"GetUserMetadata",
"can",
"be",
"used",
"to",
"extract",
"user",
"metadata",
"stored",
"in",
"a",
"context",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/rpc/grpc/auth.go#L167-L176 |
126,530 | ligato/cn-infra | db/keyval/filedb/broker.go | Put | func (pdb *BrokerWatcher) Put(key string, data []byte, opts ...datasync.PutOption) error {
return pdb.Client.Put(pdb.prefixKey(key), data, opts...)
} | go | func (pdb *BrokerWatcher) Put(key string, data []byte, opts ...datasync.PutOption) error {
return pdb.Client.Put(pdb.prefixKey(key), data, opts...)
} | [
"func",
"(",
"pdb",
"*",
"BrokerWatcher",
")",
"Put",
"(",
"key",
"string",
",",
"data",
"[",
"]",
"byte",
",",
"opts",
"...",
"datasync",
".",
"PutOption",
")",
"error",
"{",
"return",
"pdb",
".",
"Client",
".",
"Put",
"(",
"pdb",
".",
"prefixKey",
... | // Put calls client's 'Put' method | [
"Put",
"calls",
"client",
"s",
"Put",
"method"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/filedb/broker.go#L19-L21 |
126,531 | ligato/cn-infra | db/keyval/filedb/broker.go | GetValue | func (pdb *BrokerWatcher) GetValue(key string) (data []byte, found bool, revision int64, err error) {
return pdb.Client.GetValue(pdb.prefixKey(key))
} | go | func (pdb *BrokerWatcher) GetValue(key string) (data []byte, found bool, revision int64, err error) {
return pdb.Client.GetValue(pdb.prefixKey(key))
} | [
"func",
"(",
"pdb",
"*",
"BrokerWatcher",
")",
"GetValue",
"(",
"key",
"string",
")",
"(",
"data",
"[",
"]",
"byte",
",",
"found",
"bool",
",",
"revision",
"int64",
",",
"err",
"error",
")",
"{",
"return",
"pdb",
".",
"Client",
".",
"GetValue",
"(",
... | // GetValue calls client's 'GetValue' method | [
"GetValue",
"calls",
"client",
"s",
"GetValue",
"method"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/filedb/broker.go#L29-L31 |
126,532 | ligato/cn-infra | db/keyval/filedb/broker.go | Delete | func (pdb *BrokerWatcher) Delete(key string, opts ...datasync.DelOption) (existed bool, err error) {
return pdb.Client.Delete(pdb.prefixKey(key), opts...)
} | go | func (pdb *BrokerWatcher) Delete(key string, opts ...datasync.DelOption) (existed bool, err error) {
return pdb.Client.Delete(pdb.prefixKey(key), opts...)
} | [
"func",
"(",
"pdb",
"*",
"BrokerWatcher",
")",
"Delete",
"(",
"key",
"string",
",",
"opts",
"...",
"datasync",
".",
"DelOption",
")",
"(",
"existed",
"bool",
",",
"err",
"error",
")",
"{",
"return",
"pdb",
".",
"Client",
".",
"Delete",
"(",
"pdb",
".... | // Delete calls client's 'Delete' method | [
"Delete",
"calls",
"client",
"s",
"Delete",
"method"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/filedb/broker.go#L34-L36 |
126,533 | ligato/cn-infra | db/keyval/filedb/broker.go | ListValues | func (pdb *BrokerWatcher) ListValues(key string) (keyval.BytesKeyValIterator, error) {
keyValues := pdb.db.GetDataForPrefix(pdb.prefixKey(key))
data := make([]*decoder.FileDataEntry, 0, len(keyValues))
for _, entry := range keyValues {
data = append(data, &decoder.FileDataEntry{
Key: strings.TrimPrefix(entry.... | go | func (pdb *BrokerWatcher) ListValues(key string) (keyval.BytesKeyValIterator, error) {
keyValues := pdb.db.GetDataForPrefix(pdb.prefixKey(key))
data := make([]*decoder.FileDataEntry, 0, len(keyValues))
for _, entry := range keyValues {
data = append(data, &decoder.FileDataEntry{
Key: strings.TrimPrefix(entry.... | [
"func",
"(",
"pdb",
"*",
"BrokerWatcher",
")",
"ListValues",
"(",
"key",
"string",
")",
"(",
"keyval",
".",
"BytesKeyValIterator",
",",
"error",
")",
"{",
"keyValues",
":=",
"pdb",
".",
"db",
".",
"GetDataForPrefix",
"(",
"pdb",
".",
"prefixKey",
"(",
"k... | // ListValues returns a list of all database values for given key | [
"ListValues",
"returns",
"a",
"list",
"of",
"all",
"database",
"values",
"for",
"given",
"key"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/filedb/broker.go#L39-L49 |
126,534 | ligato/cn-infra | db/keyval/filedb/broker.go | ListKeys | func (pdb *BrokerWatcher) ListKeys(prefix string) (keyval.BytesKeyIterator, error) {
entries := pdb.Client.db.GetDataForPrefix(prefix)
var keys []string
for _, entry := range entries {
keys = append(keys, entry.Key)
}
return &bytesKeyIterator{len: len(keys), keys: keys, prefix: pdb.prefix}, nil
} | go | func (pdb *BrokerWatcher) ListKeys(prefix string) (keyval.BytesKeyIterator, error) {
entries := pdb.Client.db.GetDataForPrefix(prefix)
var keys []string
for _, entry := range entries {
keys = append(keys, entry.Key)
}
return &bytesKeyIterator{len: len(keys), keys: keys, prefix: pdb.prefix}, nil
} | [
"func",
"(",
"pdb",
"*",
"BrokerWatcher",
")",
"ListKeys",
"(",
"prefix",
"string",
")",
"(",
"keyval",
".",
"BytesKeyIterator",
",",
"error",
")",
"{",
"entries",
":=",
"pdb",
".",
"Client",
".",
"db",
".",
"GetDataForPrefix",
"(",
"prefix",
")",
"\n",
... | // ListKeys returns a list of all database keys for given prefix | [
"ListKeys",
"returns",
"a",
"list",
"of",
"all",
"database",
"keys",
"for",
"given",
"prefix"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/filedb/broker.go#L52-L59 |
126,535 | ligato/cn-infra | examples/tutorials/06_plugin_lookup/main.go | New | func New() *Agent {
hw := &HelloWorld{}
hu := &HelloUniverse{}
hw.Universe = hu
hu.World = hw
return &Agent{
Hu: hu,
Hw: hw,
}
} | go | func New() *Agent {
hw := &HelloWorld{}
hu := &HelloUniverse{}
hw.Universe = hu
hu.World = hw
return &Agent{
Hu: hu,
Hw: hw,
}
} | [
"func",
"New",
"(",
")",
"*",
"Agent",
"{",
"hw",
":=",
"&",
"HelloWorld",
"{",
"}",
"\n",
"hu",
":=",
"&",
"HelloUniverse",
"{",
"}",
"\n\n",
"hw",
".",
"Universe",
"=",
"hu",
"\n",
"hu",
".",
"World",
"=",
"hw",
"\n\n",
"return",
"&",
"Agent",
... | // New returns top-level plugin object with defined plugins and their dependencies | [
"New",
"returns",
"top",
"-",
"level",
"plugin",
"object",
"with",
"defined",
"plugins",
"and",
"their",
"dependencies"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/examples/tutorials/06_plugin_lookup/main.go#L55-L66 |
126,536 | ligato/cn-infra | rpc/rest/plugin_impl_rest.go | Init | func (p *Plugin) Init() (err error) {
if p.Config == nil {
p.Config = DefaultConfig()
}
if err := PluginConfig(p.Cfg, p.Config, p.PluginName); err != nil {
return err
}
// if there is no injected authenticator and there are credentials defined in the config file
// instantiate staticAuthenticator otherwise d... | go | func (p *Plugin) Init() (err error) {
if p.Config == nil {
p.Config = DefaultConfig()
}
if err := PluginConfig(p.Cfg, p.Config, p.PluginName); err != nil {
return err
}
// if there is no injected authenticator and there are credentials defined in the config file
// instantiate staticAuthenticator otherwise d... | [
"func",
"(",
"p",
"*",
"Plugin",
")",
"Init",
"(",
")",
"(",
"err",
"error",
")",
"{",
"if",
"p",
".",
"Config",
"==",
"nil",
"{",
"p",
".",
"Config",
"=",
"DefaultConfig",
"(",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"PluginConfig",
"(",
"p",... | // Init is the plugin entry point called by Agent Core
// - It prepares Gorilla MUX HTTP Router | [
"Init",
"is",
"the",
"plugin",
"entry",
"point",
"called",
"by",
"Agent",
"Core",
"-",
"It",
"prepares",
"Gorilla",
"MUX",
"HTTP",
"Router"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/rpc/rest/plugin_impl_rest.go#L55-L89 |
126,537 | ligato/cn-infra | rpc/rest/plugin_impl_rest.go | AfterInit | func (p *Plugin) AfterInit() (err error) {
cfgCopy := *p.Config
var handler http.Handler = p.mx
if p.Authenticator != nil {
handler = auth(handler, p.Authenticator)
}
p.server, err = ListenAndServe(cfgCopy, handler)
if err != nil {
return err
}
if cfgCopy.UseHTTPS() {
p.Log.Info("Listening on https://"... | go | func (p *Plugin) AfterInit() (err error) {
cfgCopy := *p.Config
var handler http.Handler = p.mx
if p.Authenticator != nil {
handler = auth(handler, p.Authenticator)
}
p.server, err = ListenAndServe(cfgCopy, handler)
if err != nil {
return err
}
if cfgCopy.UseHTTPS() {
p.Log.Info("Listening on https://"... | [
"func",
"(",
"p",
"*",
"Plugin",
")",
"AfterInit",
"(",
")",
"(",
"err",
"error",
")",
"{",
"cfgCopy",
":=",
"*",
"p",
".",
"Config",
"\n\n",
"var",
"handler",
"http",
".",
"Handler",
"=",
"p",
".",
"mx",
"\n",
"if",
"p",
".",
"Authenticator",
"!... | // AfterInit starts the HTTP server. | [
"AfterInit",
"starts",
"the",
"HTTP",
"server",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/rpc/rest/plugin_impl_rest.go#L92-L112 |
126,538 | ligato/cn-infra | rpc/rest/plugin_impl_rest.go | RegisterPermissionGroup | func (p *Plugin) RegisterPermissionGroup(group ...*access.PermissionGroup) {
if p.Config.EnableTokenAuth {
p.Log.Debugf("Registering permission group(s): %s", group)
p.auth.AddPermissionGroup(group...)
}
} | go | func (p *Plugin) RegisterPermissionGroup(group ...*access.PermissionGroup) {
if p.Config.EnableTokenAuth {
p.Log.Debugf("Registering permission group(s): %s", group)
p.auth.AddPermissionGroup(group...)
}
} | [
"func",
"(",
"p",
"*",
"Plugin",
")",
"RegisterPermissionGroup",
"(",
"group",
"...",
"*",
"access",
".",
"PermissionGroup",
")",
"{",
"if",
"p",
".",
"Config",
".",
"EnableTokenAuth",
"{",
"p",
".",
"Log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"group",... | // RegisterPermissionGroup adds new permission group if token authentication is enabled | [
"RegisterPermissionGroup",
"adds",
"new",
"permission",
"group",
"if",
"token",
"authentication",
"is",
"enabled"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/rpc/rest/plugin_impl_rest.go#L125-L130 |
126,539 | ligato/cn-infra | rpc/rest/plugin_impl_rest.go | GetPort | func (p *Plugin) GetPort() int {
if p.Config != nil {
return p.Config.GetPort()
}
return 0
} | go | func (p *Plugin) GetPort() int {
if p.Config != nil {
return p.Config.GetPort()
}
return 0
} | [
"func",
"(",
"p",
"*",
"Plugin",
")",
"GetPort",
"(",
")",
"int",
"{",
"if",
"p",
".",
"Config",
"!=",
"nil",
"{",
"return",
"p",
".",
"Config",
".",
"GetPort",
"(",
")",
"\n",
"}",
"\n",
"return",
"0",
"\n",
"}"
] | // GetPort returns plugin configuration port | [
"GetPort",
"returns",
"plugin",
"configuration",
"port"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/rpc/rest/plugin_impl_rest.go#L133-L138 |
126,540 | ligato/cn-infra | datasync/syncbase/watcher.go | Watch | func (adapter *Registry) Watch(resyncName string, changeChan chan datasync.ChangeEvent,
resyncChan chan datasync.ResyncEvent, keyPrefixes ...string) (datasync.WatchRegistration, error) {
adapter.access.Lock()
defer adapter.access.Unlock()
if _, found := adapter.subscriptions[resyncName]; found {
return nil, err... | go | func (adapter *Registry) Watch(resyncName string, changeChan chan datasync.ChangeEvent,
resyncChan chan datasync.ResyncEvent, keyPrefixes ...string) (datasync.WatchRegistration, error) {
adapter.access.Lock()
defer adapter.access.Unlock()
if _, found := adapter.subscriptions[resyncName]; found {
return nil, err... | [
"func",
"(",
"adapter",
"*",
"Registry",
")",
"Watch",
"(",
"resyncName",
"string",
",",
"changeChan",
"chan",
"datasync",
".",
"ChangeEvent",
",",
"resyncChan",
"chan",
"datasync",
".",
"ResyncEvent",
",",
"keyPrefixes",
"...",
"string",
")",
"(",
"datasync",... | // Watch only appends channels. | [
"Watch",
"only",
"appends",
"channels",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/datasync/syncbase/watcher.go#L79-L98 |
126,541 | ligato/cn-infra | datasync/syncbase/watcher.go | PropagateChanges | func (adapter *Registry) PropagateChanges(ctx context.Context, txData map[string]datasync.ChangeValue) error {
var events []func(done chan error)
for _, sub := range adapter.subscriptions {
var changes []datasync.ProtoWatchResp
for _, prefix := range sub.KeyPrefixes {
for key, val := range txData {
if !s... | go | func (adapter *Registry) PropagateChanges(ctx context.Context, txData map[string]datasync.ChangeValue) error {
var events []func(done chan error)
for _, sub := range adapter.subscriptions {
var changes []datasync.ProtoWatchResp
for _, prefix := range sub.KeyPrefixes {
for key, val := range txData {
if !s... | [
"func",
"(",
"adapter",
"*",
"Registry",
")",
"PropagateChanges",
"(",
"ctx",
"context",
".",
"Context",
",",
"txData",
"map",
"[",
"string",
"]",
"datasync",
".",
"ChangeValue",
")",
"error",
"{",
"var",
"events",
"[",
"]",
"func",
"(",
"done",
"chan",
... | // PropagateChanges fills registered channels with the data. | [
"PropagateChanges",
"fills",
"registered",
"channels",
"with",
"the",
"data",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/datasync/syncbase/watcher.go#L101-L166 |
126,542 | ligato/cn-infra | datasync/syncbase/watcher.go | PropagateResync | func (adapter *Registry) PropagateResync(ctx context.Context, txData map[string]datasync.ChangeValue) error {
var events []func(done chan error)
adapter.lastRev.Cleanup()
for _, sub := range adapter.subscriptions {
items := map[string]datasync.KeyValIterator{}
for _, prefix := range sub.KeyPrefixes {
var kv... | go | func (adapter *Registry) PropagateResync(ctx context.Context, txData map[string]datasync.ChangeValue) error {
var events []func(done chan error)
adapter.lastRev.Cleanup()
for _, sub := range adapter.subscriptions {
items := map[string]datasync.KeyValIterator{}
for _, prefix := range sub.KeyPrefixes {
var kv... | [
"func",
"(",
"adapter",
"*",
"Registry",
")",
"PropagateResync",
"(",
"ctx",
"context",
".",
"Context",
",",
"txData",
"map",
"[",
"string",
"]",
"datasync",
".",
"ChangeValue",
")",
"error",
"{",
"var",
"events",
"[",
"]",
"func",
"(",
"done",
"chan",
... | // PropagateResync fills registered channels with the data. | [
"PropagateResync",
"fills",
"registered",
"channels",
"with",
"the",
"data",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/datasync/syncbase/watcher.go#L169-L222 |
126,543 | ligato/cn-infra | datasync/syncbase/watcher.go | Close | func (reg *WatchDataReg) Close() error {
reg.adapter.access.Lock()
defer reg.adapter.access.Unlock()
for _, sub := range reg.adapter.subscriptions {
// subscription should have also change channel, otherwise it is not registered
// for change events
if sub.ChangeChan != nil && sub.CloseChan != nil {
// clo... | go | func (reg *WatchDataReg) Close() error {
reg.adapter.access.Lock()
defer reg.adapter.access.Unlock()
for _, sub := range reg.adapter.subscriptions {
// subscription should have also change channel, otherwise it is not registered
// for change events
if sub.ChangeChan != nil && sub.CloseChan != nil {
// clo... | [
"func",
"(",
"reg",
"*",
"WatchDataReg",
")",
"Close",
"(",
")",
"error",
"{",
"reg",
".",
"adapter",
".",
"access",
".",
"Lock",
"(",
")",
"\n",
"defer",
"reg",
".",
"adapter",
".",
"access",
".",
"Unlock",
"(",
")",
"\n\n",
"for",
"_",
",",
"su... | // Close stops watching of particular KeyPrefixes. | [
"Close",
"stops",
"watching",
"of",
"particular",
"KeyPrefixes",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/datasync/syncbase/watcher.go#L225-L241 |
126,544 | ligato/cn-infra | datasync/syncbase/watcher.go | Register | func (reg *WatchDataReg) Register(resyncName, keyPrefix string) error {
reg.adapter.access.Lock()
defer reg.adapter.access.Unlock()
for resName, sub := range reg.adapter.subscriptions {
if resName == resyncName {
// Verify that prefix does not exist yet
for _, regPrefix := range sub.KeyPrefixes {
if reg... | go | func (reg *WatchDataReg) Register(resyncName, keyPrefix string) error {
reg.adapter.access.Lock()
defer reg.adapter.access.Unlock()
for resName, sub := range reg.adapter.subscriptions {
if resName == resyncName {
// Verify that prefix does not exist yet
for _, regPrefix := range sub.KeyPrefixes {
if reg... | [
"func",
"(",
"reg",
"*",
"WatchDataReg",
")",
"Register",
"(",
"resyncName",
",",
"keyPrefix",
"string",
")",
"error",
"{",
"reg",
".",
"adapter",
".",
"access",
".",
"Lock",
"(",
")",
"\n",
"defer",
"reg",
".",
"adapter",
".",
"access",
".",
"Unlock",... | // Register starts watching of particular key prefix. Method returns error if key which should be added
// already exists | [
"Register",
"starts",
"watching",
"of",
"particular",
"key",
"prefix",
".",
"Method",
"returns",
"error",
"if",
"key",
"which",
"should",
"be",
"added",
"already",
"exists"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/datasync/syncbase/watcher.go#L245-L262 |
126,545 | ligato/cn-infra | datasync/syncbase/watcher.go | Unregister | func (reg *WatchDataReg) Unregister(keyPrefix string) error {
reg.adapter.access.Lock()
defer reg.adapter.access.Unlock()
subs := reg.adapter.subscriptions[reg.ResyncName]
// verify if key is registered for change events
if subs.ChangeChan == nil {
// not an error
logrus.DefaultLogger().Infof("key %v not regi... | go | func (reg *WatchDataReg) Unregister(keyPrefix string) error {
reg.adapter.access.Lock()
defer reg.adapter.access.Unlock()
subs := reg.adapter.subscriptions[reg.ResyncName]
// verify if key is registered for change events
if subs.ChangeChan == nil {
// not an error
logrus.DefaultLogger().Infof("key %v not regi... | [
"func",
"(",
"reg",
"*",
"WatchDataReg",
")",
"Unregister",
"(",
"keyPrefix",
"string",
")",
"error",
"{",
"reg",
".",
"adapter",
".",
"access",
".",
"Lock",
"(",
")",
"\n",
"defer",
"reg",
".",
"adapter",
".",
"access",
".",
"Unlock",
"(",
")",
"\n\... | // Unregister stops watching of particular key prefix. Method returns error if key which should be removed
// does not exist or in case the channel to close goroutine is nil | [
"Unregister",
"stops",
"watching",
"of",
"particular",
"key",
"prefix",
".",
"Method",
"returns",
"error",
"if",
"key",
"which",
"should",
"be",
"removed",
"does",
"not",
"exist",
"or",
"in",
"case",
"the",
"channel",
"to",
"close",
"goroutine",
"is",
"nil"
... | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/datasync/syncbase/watcher.go#L266-L291 |
126,546 | ligato/cn-infra | agent/options.go | StartTimeout | func StartTimeout(timeout time.Duration) Option {
return func(o *Options) {
o.StartTimeout = timeout
}
} | go | func StartTimeout(timeout time.Duration) Option {
return func(o *Options) {
o.StartTimeout = timeout
}
} | [
"func",
"StartTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"Option",
"{",
"return",
"func",
"(",
"o",
"*",
"Options",
")",
"{",
"o",
".",
"StartTimeout",
"=",
"timeout",
"\n",
"}",
"\n",
"}"
] | // StartTimeout returns an Option that sets timeout for the start of Agent. | [
"StartTimeout",
"returns",
"an",
"Option",
"that",
"sets",
"timeout",
"for",
"the",
"start",
"of",
"Agent",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/agent/options.go#L73-L77 |
126,547 | ligato/cn-infra | agent/options.go | StopTimeout | func StopTimeout(timeout time.Duration) Option {
return func(o *Options) {
o.StopTimeout = timeout
}
} | go | func StopTimeout(timeout time.Duration) Option {
return func(o *Options) {
o.StopTimeout = timeout
}
} | [
"func",
"StopTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"Option",
"{",
"return",
"func",
"(",
"o",
"*",
"Options",
")",
"{",
"o",
".",
"StopTimeout",
"=",
"timeout",
"\n",
"}",
"\n",
"}"
] | // StopTimeout returns an Option that sets timeout for the stop of Agent. | [
"StopTimeout",
"returns",
"an",
"Option",
"that",
"sets",
"timeout",
"for",
"the",
"stop",
"of",
"Agent",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/agent/options.go#L80-L84 |
126,548 | ligato/cn-infra | agent/options.go | Version | func Version(buildVer, buildDate, commitHash string) Option {
return func(o *Options) {
BuildVersion = buildVer
BuildDate = buildDate
CommitHash = commitHash
}
} | go | func Version(buildVer, buildDate, commitHash string) Option {
return func(o *Options) {
BuildVersion = buildVer
BuildDate = buildDate
CommitHash = commitHash
}
} | [
"func",
"Version",
"(",
"buildVer",
",",
"buildDate",
",",
"commitHash",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"o",
"*",
"Options",
")",
"{",
"BuildVersion",
"=",
"buildVer",
"\n",
"BuildDate",
"=",
"buildDate",
"\n",
"CommitHash",
"=",
"com... | // Version returns an Option that sets the version of the Agent to the entered string | [
"Version",
"returns",
"an",
"Option",
"that",
"sets",
"the",
"version",
"of",
"the",
"Agent",
"to",
"the",
"entered",
"string"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/agent/options.go#L87-L93 |
126,549 | ligato/cn-infra | agent/options.go | QuitSignals | func QuitSignals(sigs ...os.Signal) Option {
return func(o *Options) {
o.QuitSignals = sigs
}
} | go | func QuitSignals(sigs ...os.Signal) Option {
return func(o *Options) {
o.QuitSignals = sigs
}
} | [
"func",
"QuitSignals",
"(",
"sigs",
"...",
"os",
".",
"Signal",
")",
"Option",
"{",
"return",
"func",
"(",
"o",
"*",
"Options",
")",
"{",
"o",
".",
"QuitSignals",
"=",
"sigs",
"\n",
"}",
"\n",
"}"
] | // QuitSignals returns an Option that will set signals which stop Agent | [
"QuitSignals",
"returns",
"an",
"Option",
"that",
"will",
"set",
"signals",
"which",
"stop",
"Agent"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/agent/options.go#L103-L107 |
126,550 | ligato/cn-infra | agent/options.go | Plugins | func Plugins(plugins ...infra.Plugin) Option {
return func(o *Options) {
o.Plugins = append(o.Plugins, plugins...)
}
} | go | func Plugins(plugins ...infra.Plugin) Option {
return func(o *Options) {
o.Plugins = append(o.Plugins, plugins...)
}
} | [
"func",
"Plugins",
"(",
"plugins",
"...",
"infra",
".",
"Plugin",
")",
"Option",
"{",
"return",
"func",
"(",
"o",
"*",
"Options",
")",
"{",
"o",
".",
"Plugins",
"=",
"append",
"(",
"o",
".",
"Plugins",
",",
"plugins",
"...",
")",
"\n",
"}",
"\n",
... | // Plugins creates an Option that adds a list of Plugins to the Agent's Plugin list | [
"Plugins",
"creates",
"an",
"Option",
"that",
"adds",
"a",
"list",
"of",
"Plugins",
"to",
"the",
"Agent",
"s",
"Plugin",
"list"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/agent/options.go#L117-L121 |
126,551 | ligato/cn-infra | agent/options.go | AllPlugins | func AllPlugins(plugins ...infra.Plugin) Option {
return func(o *Options) {
infraLogger.Debugf("AllPlugins with %d plugins", len(plugins))
for _, plugin := range plugins {
typ := reflect.TypeOf(plugin)
infraLogger.Debugf("searching for all deps in: %v (type: %v)", plugin, typ)
foundPlugins, err := findP... | go | func AllPlugins(plugins ...infra.Plugin) Option {
return func(o *Options) {
infraLogger.Debugf("AllPlugins with %d plugins", len(plugins))
for _, plugin := range plugins {
typ := reflect.TypeOf(plugin)
infraLogger.Debugf("searching for all deps in: %v (type: %v)", plugin, typ)
foundPlugins, err := findP... | [
"func",
"AllPlugins",
"(",
"plugins",
"...",
"infra",
".",
"Plugin",
")",
"Option",
"{",
"return",
"func",
"(",
"o",
"*",
"Options",
")",
"{",
"infraLogger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"len",
"(",
"plugins",
")",
")",
"\n\n",
"for",
"_",
... | // AllPlugins creates an Option that adds all of the nested
// plugins recursively to the Agent's plugin list. | [
"AllPlugins",
"creates",
"an",
"Option",
"that",
"adds",
"all",
"of",
"the",
"nested",
"plugins",
"recursively",
"to",
"the",
"Agent",
"s",
"plugin",
"list",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/agent/options.go#L125-L162 |
126,552 | ligato/cn-infra | db/keyval/redis/bytes_txn_impl.go | Put | func (tx *Txn) Put(key string, value []byte) keyval.BytesTxn {
if tx.addPrefix != nil {
key = tx.addPrefix(key)
}
tx.ops = append(tx.ops, op{key, value, false})
return tx
} | go | func (tx *Txn) Put(key string, value []byte) keyval.BytesTxn {
if tx.addPrefix != nil {
key = tx.addPrefix(key)
}
tx.ops = append(tx.ops, op{key, value, false})
return tx
} | [
"func",
"(",
"tx",
"*",
"Txn",
")",
"Put",
"(",
"key",
"string",
",",
"value",
"[",
"]",
"byte",
")",
"keyval",
".",
"BytesTxn",
"{",
"if",
"tx",
".",
"addPrefix",
"!=",
"nil",
"{",
"key",
"=",
"tx",
".",
"addPrefix",
"(",
"key",
")",
"\n",
"}"... | // Put adds a new 'put' operation to a previously created transaction.
// If the key does not exist in the data store, a new key-value item
// will be added to the data store. If the key exists in the data store,
// the existing value will be overwritten with the value from this
// operation. | [
"Put",
"adds",
"a",
"new",
"put",
"operation",
"to",
"a",
"previously",
"created",
"transaction",
".",
"If",
"the",
"key",
"does",
"not",
"exist",
"in",
"the",
"data",
"store",
"a",
"new",
"key",
"-",
"value",
"item",
"will",
"be",
"added",
"to",
"the"... | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/redis/bytes_txn_impl.go#L46-L52 |
126,553 | ligato/cn-infra | datasync/kvdbsync/iterator.go | GetNext | func (it *Iterator) GetNext() (kv datasync.KeyVal, stop bool) {
kv, stop = it.delegate.GetNext()
if stop {
return nil, stop
}
return kv, stop
} | go | func (it *Iterator) GetNext() (kv datasync.KeyVal, stop bool) {
kv, stop = it.delegate.GetNext()
if stop {
return nil, stop
}
return kv, stop
} | [
"func",
"(",
"it",
"*",
"Iterator",
")",
"GetNext",
"(",
")",
"(",
"kv",
"datasync",
".",
"KeyVal",
",",
"stop",
"bool",
")",
"{",
"kv",
",",
"stop",
"=",
"it",
".",
"delegate",
".",
"GetNext",
"(",
")",
"\n",
"if",
"stop",
"{",
"return",
"nil",
... | // GetNext only delegates the call to internal iterator. | [
"GetNext",
"only",
"delegates",
"the",
"call",
"to",
"internal",
"iterator",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/datasync/kvdbsync/iterator.go#L33-L39 |
126,554 | ligato/cn-infra | health/statuscheck/plugin_impl_statuscheck.go | Init | func (p *Plugin) Init() error {
// write initial status data into ETCD
p.agentStat = &status.AgentStatus{
State: status.OperationalState_INIT,
BuildVersion: agent.BuildVersion,
BuildDate: agent.BuildDate,
CommitHash: agent.CommitHash,
StartTime: time.Now().Unix(),
LastChange: time.Now().U... | go | func (p *Plugin) Init() error {
// write initial status data into ETCD
p.agentStat = &status.AgentStatus{
State: status.OperationalState_INIT,
BuildVersion: agent.BuildVersion,
BuildDate: agent.BuildDate,
CommitHash: agent.CommitHash,
StartTime: time.Now().Unix(),
LastChange: time.Now().U... | [
"func",
"(",
"p",
"*",
"Plugin",
")",
"Init",
"(",
")",
"error",
"{",
"// write initial status data into ETCD",
"p",
".",
"agentStat",
"=",
"&",
"status",
".",
"AgentStatus",
"{",
"State",
":",
"status",
".",
"OperationalState_INIT",
",",
"BuildVersion",
":",
... | // Init prepares the initial status data. | [
"Init",
"prepares",
"the",
"initial",
"status",
"data",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/health/statuscheck/plugin_impl_statuscheck.go#L61-L85 |
126,555 | ligato/cn-infra | health/statuscheck/plugin_impl_statuscheck.go | AfterInit | func (p *Plugin) AfterInit() error {
p.access.Lock()
defer p.access.Unlock()
// do periodic status probing for plugins that have provided the probe function
go p.periodicProbing(p.ctx)
// do periodic updates of the state data in ETCD
go p.periodicUpdates(p.ctx)
p.publishAgentData()
// transition to OK state... | go | func (p *Plugin) AfterInit() error {
p.access.Lock()
defer p.access.Unlock()
// do periodic status probing for plugins that have provided the probe function
go p.periodicProbing(p.ctx)
// do periodic updates of the state data in ETCD
go p.periodicUpdates(p.ctx)
p.publishAgentData()
// transition to OK state... | [
"func",
"(",
"p",
"*",
"Plugin",
")",
"AfterInit",
"(",
")",
"error",
"{",
"p",
".",
"access",
".",
"Lock",
"(",
")",
"\n",
"defer",
"p",
".",
"access",
".",
"Unlock",
"(",
")",
"\n\n",
"// do periodic status probing for plugins that have provided the probe fu... | // AfterInit starts go routines for periodic probing and periodic updates.
// Initial state data are published via the injected transport. | [
"AfterInit",
"starts",
"go",
"routines",
"for",
"periodic",
"probing",
"and",
"periodic",
"updates",
".",
"Initial",
"state",
"data",
"are",
"published",
"via",
"the",
"injected",
"transport",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/health/statuscheck/plugin_impl_statuscheck.go#L89-L109 |
126,556 | ligato/cn-infra | health/statuscheck/plugin_impl_statuscheck.go | Close | func (p *Plugin) Close() error {
p.cancel()
p.wg.Wait()
return nil
} | go | func (p *Plugin) Close() error {
p.cancel()
p.wg.Wait()
return nil
} | [
"func",
"(",
"p",
"*",
"Plugin",
")",
"Close",
"(",
")",
"error",
"{",
"p",
".",
"cancel",
"(",
")",
"\n",
"p",
".",
"wg",
".",
"Wait",
"(",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] | // Close stops go routines for periodic probing and periodic updates. | [
"Close",
"stops",
"go",
"routines",
"for",
"periodic",
"probing",
"and",
"periodic",
"updates",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/health/statuscheck/plugin_impl_statuscheck.go#L112-L117 |
126,557 | ligato/cn-infra | health/statuscheck/plugin_impl_statuscheck.go | Register | func (p *Plugin) Register(pluginName infra.PluginName, probe PluginStateProbe) {
p.access.Lock()
defer p.access.Unlock()
stat := &status.PluginStatus{
State: status.OperationalState_INIT,
LastChange: time.Now().Unix(),
}
p.pluginStat[string(pluginName)] = stat
if probe != nil {
p.pluginProbe[string(p... | go | func (p *Plugin) Register(pluginName infra.PluginName, probe PluginStateProbe) {
p.access.Lock()
defer p.access.Unlock()
stat := &status.PluginStatus{
State: status.OperationalState_INIT,
LastChange: time.Now().Unix(),
}
p.pluginStat[string(pluginName)] = stat
if probe != nil {
p.pluginProbe[string(p... | [
"func",
"(",
"p",
"*",
"Plugin",
")",
"Register",
"(",
"pluginName",
"infra",
".",
"PluginName",
",",
"probe",
"PluginStateProbe",
")",
"{",
"p",
".",
"access",
".",
"Lock",
"(",
")",
"\n",
"defer",
"p",
".",
"access",
".",
"Unlock",
"(",
")",
"\n\n"... | // Register a plugin for status change reporting. | [
"Register",
"a",
"plugin",
"for",
"status",
"change",
"reporting",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/health/statuscheck/plugin_impl_statuscheck.go#L120-L138 |
126,558 | ligato/cn-infra | health/statuscheck/plugin_impl_statuscheck.go | ReportStateChange | func (p *Plugin) ReportStateChange(pluginName infra.PluginName, state PluginState, lastError error) {
p.reportStateChange(pluginName, state, lastError)
} | go | func (p *Plugin) ReportStateChange(pluginName infra.PluginName, state PluginState, lastError error) {
p.reportStateChange(pluginName, state, lastError)
} | [
"func",
"(",
"p",
"*",
"Plugin",
")",
"ReportStateChange",
"(",
"pluginName",
"infra",
".",
"PluginName",
",",
"state",
"PluginState",
",",
"lastError",
"error",
")",
"{",
"p",
".",
"reportStateChange",
"(",
"pluginName",
",",
"state",
",",
"lastError",
")",... | // ReportStateChange can be used to report a change in the status of a previously registered plugin. | [
"ReportStateChange",
"can",
"be",
"used",
"to",
"report",
"a",
"change",
"in",
"the",
"status",
"of",
"a",
"previously",
"registered",
"plugin",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/health/statuscheck/plugin_impl_statuscheck.go#L141-L143 |
126,559 | ligato/cn-infra | health/statuscheck/plugin_impl_statuscheck.go | ReportStateChangeWithMeta | func (p *Plugin) ReportStateChangeWithMeta(pluginName infra.PluginName, state PluginState, lastError error, meta proto.Message) {
p.reportStateChange(pluginName, state, lastError)
switch data := meta.(type) {
case *status.InterfaceStats_Interface:
p.reportInterfaceStateChange(data)
default:
p.Log.Debug("Unknow... | go | func (p *Plugin) ReportStateChangeWithMeta(pluginName infra.PluginName, state PluginState, lastError error, meta proto.Message) {
p.reportStateChange(pluginName, state, lastError)
switch data := meta.(type) {
case *status.InterfaceStats_Interface:
p.reportInterfaceStateChange(data)
default:
p.Log.Debug("Unknow... | [
"func",
"(",
"p",
"*",
"Plugin",
")",
"ReportStateChangeWithMeta",
"(",
"pluginName",
"infra",
".",
"PluginName",
",",
"state",
"PluginState",
",",
"lastError",
"error",
",",
"meta",
"proto",
".",
"Message",
")",
"{",
"p",
".",
"reportStateChange",
"(",
"plu... | // ReportStateChangeWithMeta can be used to report a change in the status of a previously registered plugin and report
// the specific metadata state | [
"ReportStateChangeWithMeta",
"can",
"be",
"used",
"to",
"report",
"a",
"change",
"in",
"the",
"status",
"of",
"a",
"previously",
"registered",
"plugin",
"and",
"report",
"the",
"specific",
"metadata",
"state"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/health/statuscheck/plugin_impl_statuscheck.go#L147-L156 |
126,560 | ligato/cn-infra | health/statuscheck/plugin_impl_statuscheck.go | publishAgentData | func (p *Plugin) publishAgentData() error {
p.agentStat.LastUpdate = time.Now().Unix()
if p.Transport != nil {
return p.Transport.Put(status.AgentStatusKey(), p.agentStat)
}
return nil
} | go | func (p *Plugin) publishAgentData() error {
p.agentStat.LastUpdate = time.Now().Unix()
if p.Transport != nil {
return p.Transport.Put(status.AgentStatusKey(), p.agentStat)
}
return nil
} | [
"func",
"(",
"p",
"*",
"Plugin",
")",
"publishAgentData",
"(",
")",
"error",
"{",
"p",
".",
"agentStat",
".",
"LastUpdate",
"=",
"time",
".",
"Now",
"(",
")",
".",
"Unix",
"(",
")",
"\n",
"if",
"p",
".",
"Transport",
"!=",
"nil",
"{",
"return",
"... | // publishAgentData writes the current global agent state into ETCD. | [
"publishAgentData",
"writes",
"the",
"current",
"global",
"agent",
"state",
"into",
"ETCD",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/health/statuscheck/plugin_impl_statuscheck.go#L256-L262 |
126,561 | ligato/cn-infra | health/statuscheck/plugin_impl_statuscheck.go | publishPluginData | func (p *Plugin) publishPluginData(pluginName infra.PluginName, pluginStat *status.PluginStatus) error {
pluginStat.LastUpdate = time.Now().Unix()
if p.Transport != nil {
return p.Transport.Put(status.PluginStatusKey(string(pluginName)), pluginStat)
}
return nil
} | go | func (p *Plugin) publishPluginData(pluginName infra.PluginName, pluginStat *status.PluginStatus) error {
pluginStat.LastUpdate = time.Now().Unix()
if p.Transport != nil {
return p.Transport.Put(status.PluginStatusKey(string(pluginName)), pluginStat)
}
return nil
} | [
"func",
"(",
"p",
"*",
"Plugin",
")",
"publishPluginData",
"(",
"pluginName",
"infra",
".",
"PluginName",
",",
"pluginStat",
"*",
"status",
".",
"PluginStatus",
")",
"error",
"{",
"pluginStat",
".",
"LastUpdate",
"=",
"time",
".",
"Now",
"(",
")",
".",
"... | // publishPluginData writes the current plugin state into ETCD. | [
"publishPluginData",
"writes",
"the",
"current",
"plugin",
"state",
"into",
"ETCD",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/health/statuscheck/plugin_impl_statuscheck.go#L265-L271 |
126,562 | ligato/cn-infra | health/statuscheck/plugin_impl_statuscheck.go | publishAllData | func (p *Plugin) publishAllData() {
p.access.Lock()
defer p.access.Unlock()
p.publishAgentData()
for name, s := range p.pluginStat {
p.publishPluginData(infra.PluginName(name), s)
}
} | go | func (p *Plugin) publishAllData() {
p.access.Lock()
defer p.access.Unlock()
p.publishAgentData()
for name, s := range p.pluginStat {
p.publishPluginData(infra.PluginName(name), s)
}
} | [
"func",
"(",
"p",
"*",
"Plugin",
")",
"publishAllData",
"(",
")",
"{",
"p",
".",
"access",
".",
"Lock",
"(",
")",
"\n",
"defer",
"p",
".",
"access",
".",
"Unlock",
"(",
")",
"\n\n",
"p",
".",
"publishAgentData",
"(",
")",
"\n",
"for",
"name",
","... | // publishAllData publishes global agent + all plugins state data into ETCD. | [
"publishAllData",
"publishes",
"global",
"agent",
"+",
"all",
"plugins",
"state",
"data",
"into",
"ETCD",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/health/statuscheck/plugin_impl_statuscheck.go#L274-L282 |
126,563 | ligato/cn-infra | health/statuscheck/plugin_impl_statuscheck.go | periodicProbing | func (p *Plugin) periodicProbing(ctx context.Context) {
p.wg.Add(1)
defer p.wg.Done()
for {
select {
case <-time.After(PeriodicProbingTimeout):
for pluginName, probe := range p.pluginProbe {
state, lastErr := probe()
p.ReportStateChange(infra.PluginName(pluginName), state, lastErr)
// just check ... | go | func (p *Plugin) periodicProbing(ctx context.Context) {
p.wg.Add(1)
defer p.wg.Done()
for {
select {
case <-time.After(PeriodicProbingTimeout):
for pluginName, probe := range p.pluginProbe {
state, lastErr := probe()
p.ReportStateChange(infra.PluginName(pluginName), state, lastErr)
// just check ... | [
"func",
"(",
"p",
"*",
"Plugin",
")",
"periodicProbing",
"(",
"ctx",
"context",
".",
"Context",
")",
"{",
"p",
".",
"wg",
".",
"Add",
"(",
"1",
")",
"\n",
"defer",
"p",
".",
"wg",
".",
"Done",
"(",
")",
"\n\n",
"for",
"{",
"select",
"{",
"case"... | // periodicProbing does periodic status probing for all plugins
// that have registered probe functions. | [
"periodicProbing",
"does",
"periodic",
"status",
"probing",
"for",
"all",
"plugins",
"that",
"have",
"registered",
"probe",
"functions",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/health/statuscheck/plugin_impl_statuscheck.go#L286-L309 |
126,564 | ligato/cn-infra | health/statuscheck/plugin_impl_statuscheck.go | periodicUpdates | func (p *Plugin) periodicUpdates(ctx context.Context) {
p.wg.Add(1)
defer p.wg.Done()
for {
select {
case <-time.After(PeriodicWriteTimeout):
p.publishAllData()
case <-ctx.Done():
return
}
}
} | go | func (p *Plugin) periodicUpdates(ctx context.Context) {
p.wg.Add(1)
defer p.wg.Done()
for {
select {
case <-time.After(PeriodicWriteTimeout):
p.publishAllData()
case <-ctx.Done():
return
}
}
} | [
"func",
"(",
"p",
"*",
"Plugin",
")",
"periodicUpdates",
"(",
"ctx",
"context",
".",
"Context",
")",
"{",
"p",
".",
"wg",
".",
"Add",
"(",
"1",
")",
"\n",
"defer",
"p",
".",
"wg",
".",
"Done",
"(",
")",
"\n\n",
"for",
"{",
"select",
"{",
"case"... | // periodicUpdates does periodic writes of state data into ETCD. | [
"periodicUpdates",
"does",
"periodic",
"writes",
"of",
"state",
"data",
"into",
"ETCD",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/health/statuscheck/plugin_impl_statuscheck.go#L312-L325 |
126,565 | ligato/cn-infra | health/statuscheck/plugin_impl_statuscheck.go | getAgentState | func (p *Plugin) getAgentState() status.OperationalState {
p.access.Lock()
defer p.access.Unlock()
return p.agentStat.State
} | go | func (p *Plugin) getAgentState() status.OperationalState {
p.access.Lock()
defer p.access.Unlock()
return p.agentStat.State
} | [
"func",
"(",
"p",
"*",
"Plugin",
")",
"getAgentState",
"(",
")",
"status",
".",
"OperationalState",
"{",
"p",
".",
"access",
".",
"Lock",
"(",
")",
"\n",
"defer",
"p",
".",
"access",
".",
"Unlock",
"(",
")",
"\n",
"return",
"p",
".",
"agentStat",
"... | // getAgentState return current global operational state of the agent. | [
"getAgentState",
"return",
"current",
"global",
"operational",
"state",
"of",
"the",
"agent",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/health/statuscheck/plugin_impl_statuscheck.go#L328-L332 |
126,566 | ligato/cn-infra | health/statuscheck/plugin_impl_statuscheck.go | GetAllPluginStatus | func (p *Plugin) GetAllPluginStatus() map[string]*status.PluginStatus {
//TODO - used currently, will be removed after incoporating improvements for exposing copy of map
p.access.Lock()
defer p.access.Unlock()
return p.pluginStat
} | go | func (p *Plugin) GetAllPluginStatus() map[string]*status.PluginStatus {
//TODO - used currently, will be removed after incoporating improvements for exposing copy of map
p.access.Lock()
defer p.access.Unlock()
return p.pluginStat
} | [
"func",
"(",
"p",
"*",
"Plugin",
")",
"GetAllPluginStatus",
"(",
")",
"map",
"[",
"string",
"]",
"*",
"status",
".",
"PluginStatus",
"{",
"//TODO - used currently, will be removed after incoporating improvements for exposing copy of map",
"p",
".",
"access",
".",
"Lock"... | // GetAllPluginStatus returns a map containing pluginname and its status, for all plugins | [
"GetAllPluginStatus",
"returns",
"a",
"map",
"containing",
"pluginname",
"and",
"its",
"status",
"for",
"all",
"plugins"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/health/statuscheck/plugin_impl_statuscheck.go#L335-L341 |
126,567 | ligato/cn-infra | health/statuscheck/plugin_impl_statuscheck.go | GetInterfaceStats | func (p *Plugin) GetInterfaceStats() status.InterfaceStats {
p.access.Lock()
defer p.access.Unlock()
return *p.interfaceStat
} | go | func (p *Plugin) GetInterfaceStats() status.InterfaceStats {
p.access.Lock()
defer p.access.Unlock()
return *p.interfaceStat
} | [
"func",
"(",
"p",
"*",
"Plugin",
")",
"GetInterfaceStats",
"(",
")",
"status",
".",
"InterfaceStats",
"{",
"p",
".",
"access",
".",
"Lock",
"(",
")",
"\n",
"defer",
"p",
".",
"access",
".",
"Unlock",
"(",
")",
"\n\n",
"return",
"*",
"p",
".",
"inte... | // GetInterfaceStats returns current global operational status of interfaces | [
"GetInterfaceStats",
"returns",
"current",
"global",
"operational",
"status",
"of",
"interfaces"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/health/statuscheck/plugin_impl_statuscheck.go#L344-L349 |
126,568 | ligato/cn-infra | health/statuscheck/plugin_impl_statuscheck.go | GetAgentStatus | func (p *Plugin) GetAgentStatus() status.AgentStatus {
p.access.Lock()
defer p.access.Unlock()
return *p.agentStat
} | go | func (p *Plugin) GetAgentStatus() status.AgentStatus {
p.access.Lock()
defer p.access.Unlock()
return *p.agentStat
} | [
"func",
"(",
"p",
"*",
"Plugin",
")",
"GetAgentStatus",
"(",
")",
"status",
".",
"AgentStatus",
"{",
"p",
".",
"access",
".",
"Lock",
"(",
")",
"\n",
"defer",
"p",
".",
"access",
".",
"Unlock",
"(",
")",
"\n",
"return",
"*",
"p",
".",
"agentStat",
... | // GetAgentStatus return current global operational state of the agent. | [
"GetAgentStatus",
"return",
"current",
"global",
"operational",
"state",
"of",
"the",
"agent",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/health/statuscheck/plugin_impl_statuscheck.go#L352-L356 |
126,569 | ligato/cn-infra | health/statuscheck/plugin_impl_statuscheck.go | stateToProto | func stateToProto(state PluginState) status.OperationalState {
switch state {
case Init:
return status.OperationalState_INIT
case OK:
return status.OperationalState_OK
default:
return status.OperationalState_ERROR
}
} | go | func stateToProto(state PluginState) status.OperationalState {
switch state {
case Init:
return status.OperationalState_INIT
case OK:
return status.OperationalState_OK
default:
return status.OperationalState_ERROR
}
} | [
"func",
"stateToProto",
"(",
"state",
"PluginState",
")",
"status",
".",
"OperationalState",
"{",
"switch",
"state",
"{",
"case",
"Init",
":",
"return",
"status",
".",
"OperationalState_INIT",
"\n",
"case",
"OK",
":",
"return",
"status",
".",
"OperationalState_O... | // stateToProto converts agent state type into protobuf agent state type. | [
"stateToProto",
"converts",
"agent",
"state",
"type",
"into",
"protobuf",
"agent",
"state",
"type",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/health/statuscheck/plugin_impl_statuscheck.go#L359-L368 |
126,570 | ligato/cn-infra | examples/process-manager-plugin/basic-scenario/main.go | runWatcher | func (p *PMExample) runWatcher(state *status.ProcessStatus, notifyChan chan status.ProcessStatus) {
for {
select {
case currentState, ok := <-notifyChan:
if !ok {
p.Log.Infof("===>(watcher) process watcher ended")
return
}
*state = currentState
p.Log.Infof("===>(watcher) received test process s... | go | func (p *PMExample) runWatcher(state *status.ProcessStatus, notifyChan chan status.ProcessStatus) {
for {
select {
case currentState, ok := <-notifyChan:
if !ok {
p.Log.Infof("===>(watcher) process watcher ended")
return
}
*state = currentState
p.Log.Infof("===>(watcher) received test process s... | [
"func",
"(",
"p",
"*",
"PMExample",
")",
"runWatcher",
"(",
"state",
"*",
"status",
".",
"ProcessStatus",
",",
"notifyChan",
"chan",
"status",
".",
"ProcessStatus",
")",
"{",
"for",
"{",
"select",
"{",
"case",
"currentState",
",",
"ok",
":=",
"<-",
"noti... | // Starts the process watcher using provided chanel. | [
"Starts",
"the",
"process",
"watcher",
"using",
"provided",
"chanel",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/examples/process-manager-plugin/basic-scenario/main.go#L185-L197 |
126,571 | ligato/cn-infra | messaging/kafka/client/consumer.go | NewConsumer | func NewConsumer(config *Config, wg *sync.WaitGroup) (*Consumer, error) {
if config.Debug {
config.Logger.SetLevel(logging.DebugLevel)
}
config.Logger.Debug("entering NewConsumer ...")
if err := config.ValidateConsumerConfig(); err != nil {
return nil, err
}
config.Logger.Debugf("Consumer config: %#v", config... | go | func NewConsumer(config *Config, wg *sync.WaitGroup) (*Consumer, error) {
if config.Debug {
config.Logger.SetLevel(logging.DebugLevel)
}
config.Logger.Debug("entering NewConsumer ...")
if err := config.ValidateConsumerConfig(); err != nil {
return nil, err
}
config.Logger.Debugf("Consumer config: %#v", config... | [
"func",
"NewConsumer",
"(",
"config",
"*",
"Config",
",",
"wg",
"*",
"sync",
".",
"WaitGroup",
")",
"(",
"*",
"Consumer",
",",
"error",
")",
"{",
"if",
"config",
".",
"Debug",
"{",
"config",
".",
"Logger",
".",
"SetLevel",
"(",
"logging",
".",
"Debug... | // NewConsumer returns a Consumer instance. If startHandlers is set to true, reading of messages, errors
// and notifications is started using new consumer. Otherwise, only instance is returned | [
"NewConsumer",
"returns",
"a",
"Consumer",
"instance",
".",
"If",
"startHandlers",
"is",
"set",
"to",
"true",
"reading",
"of",
"messages",
"errors",
"and",
"notifications",
"is",
"started",
"using",
"new",
"consumer",
".",
"Otherwise",
"only",
"instance",
"is",
... | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/client/consumer.go#L55-L103 |
126,572 | ligato/cn-infra | messaging/kafka/client/consumer.go | StartConsumerManualHandlers | func (ref *Consumer) StartConsumerManualHandlers(partitionConsumer sarama.PartitionConsumer) {
config := ref.Config
config.Logger.Info("Starting message handlers for new manual consumer ...")
// if required, start reading from the errors channel
if config.ProducerConfig().Consumer.Return.Errors {
go ref.manualEr... | go | func (ref *Consumer) StartConsumerManualHandlers(partitionConsumer sarama.PartitionConsumer) {
config := ref.Config
config.Logger.Info("Starting message handlers for new manual consumer ...")
// if required, start reading from the errors channel
if config.ProducerConfig().Consumer.Return.Errors {
go ref.manualEr... | [
"func",
"(",
"ref",
"*",
"Consumer",
")",
"StartConsumerManualHandlers",
"(",
"partitionConsumer",
"sarama",
".",
"PartitionConsumer",
")",
"{",
"config",
":=",
"ref",
".",
"Config",
"\n",
"config",
".",
"Logger",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n\n",
... | // StartConsumerManualHandlers starts required handlers using sarama partition consumer. Used when partitioner set in config is
// manual | [
"StartConsumerManualHandlers",
"starts",
"required",
"handlers",
"using",
"sarama",
"partition",
"consumer",
".",
"Used",
"when",
"partitioner",
"set",
"in",
"config",
"is",
"manual"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/client/consumer.go#L126-L137 |
126,573 | ligato/cn-infra | messaging/kafka/client/consumer.go | NewClient | func NewClient(config *Config, partitioner string) (sarama.Client, error) {
config.Logger.Debug("Creating new consumer")
if err := config.ValidateAsyncProducerConfig(); err != nil {
return nil, err
}
config.SetSendSuccess(true)
config.SetSuccessChan(make(chan *ProducerMessage))
config.SetSendError(true)
confi... | go | func NewClient(config *Config, partitioner string) (sarama.Client, error) {
config.Logger.Debug("Creating new consumer")
if err := config.ValidateAsyncProducerConfig(); err != nil {
return nil, err
}
config.SetSendSuccess(true)
config.SetSuccessChan(make(chan *ProducerMessage))
config.SetSendError(true)
confi... | [
"func",
"NewClient",
"(",
"config",
"*",
"Config",
",",
"partitioner",
"string",
")",
"(",
"sarama",
".",
"Client",
",",
"error",
")",
"{",
"config",
".",
"Logger",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
":=",
"config",
".",
"Validate... | // NewClient initializes new sarama client instance from provided config and with defined partitioner | [
"NewClient",
"initializes",
"new",
"sarama",
"client",
"instance",
"from",
"provided",
"config",
"and",
"with",
"defined",
"partitioner"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/client/consumer.go#L140-L179 |
126,574 | ligato/cn-infra | messaging/kafka/client/consumer.go | Close | func (ref *Consumer) Close() error {
ref.Debug("entering consumer close ...")
defer func() {
ref.Debug("running defer ...")
if ref.closed {
ref.Debug("consumer already closed ...")
ref.Unlock()
return
}
ref.Debug("setting closed ...")
ref.closed = true
ref.Debug("closing closeChannel channel ..."... | go | func (ref *Consumer) Close() error {
ref.Debug("entering consumer close ...")
defer func() {
ref.Debug("running defer ...")
if ref.closed {
ref.Debug("consumer already closed ...")
ref.Unlock()
return
}
ref.Debug("setting closed ...")
ref.closed = true
ref.Debug("closing closeChannel channel ..."... | [
"func",
"(",
"ref",
"*",
"Consumer",
")",
"Close",
"(",
")",
"error",
"{",
"ref",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"defer",
"func",
"(",
")",
"{",
"ref",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"if",
"ref",
".",
"closed",
"{",
"ref... | // Close closes the client and consumer | [
"Close",
"closes",
"the",
"client",
"and",
"consumer"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/client/consumer.go#L182-L219 |
126,575 | ligato/cn-infra | messaging/kafka/client/consumer.go | PrintNotification | func (ref *Consumer) PrintNotification(note map[string][]int32) {
for k, v := range note {
fmt.Printf(" Topic: %s\n", k)
fmt.Printf(" Partitions: %v\n", v)
}
} | go | func (ref *Consumer) PrintNotification(note map[string][]int32) {
for k, v := range note {
fmt.Printf(" Topic: %s\n", k)
fmt.Printf(" Partitions: %v\n", v)
}
} | [
"func",
"(",
"ref",
"*",
"Consumer",
")",
"PrintNotification",
"(",
"note",
"map",
"[",
"string",
"]",
"[",
"]",
"int32",
")",
"{",
"for",
"k",
",",
"v",
":=",
"range",
"note",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"k",
")",
"... | // PrintNotification print the topics and partitions | [
"PrintNotification",
"print",
"the",
"topics",
"and",
"partitions"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/client/consumer.go#L267-L272 |
126,576 | ligato/cn-infra | messaging/kafka/client/consumer.go | messageHandler | func (ref *Consumer) messageHandler(in <-chan *sarama.ConsumerMessage) {
ref.Debug("messageHandler started ...")
var prevValue []byte
for {
select {
case msg := <-in:
if msg == nil {
continue
}
consumerMsg := &ConsumerMessage{
Key: msg.Key,
Value: msg.Value,
PrevValue: prevVal... | go | func (ref *Consumer) messageHandler(in <-chan *sarama.ConsumerMessage) {
ref.Debug("messageHandler started ...")
var prevValue []byte
for {
select {
case msg := <-in:
if msg == nil {
continue
}
consumerMsg := &ConsumerMessage{
Key: msg.Key,
Value: msg.Value,
PrevValue: prevVal... | [
"func",
"(",
"ref",
"*",
"Consumer",
")",
"messageHandler",
"(",
"in",
"<-",
"chan",
"*",
"sarama",
".",
"ConsumerMessage",
")",
"{",
"ref",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"var",
"prevValue",
"[",
"]",
"byte",
"\n\n",
"for",
"{",
"select",... | // messageHandler processes each incoming message | [
"messageHandler",
"processes",
"each",
"incoming",
"message"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/client/consumer.go#L275-L306 |
126,577 | ligato/cn-infra | messaging/kafka/client/consumer.go | manualErrorHandler | func (ref *Consumer) manualErrorHandler(in <-chan *sarama.ConsumerError) {
ref.Debug("errorHandler started ...")
for {
select {
case err, more := <-in:
if more {
ref.Errorf("message error: %T, %v", err, err)
ref.Config.RecvErrorChan <- err
}
case <-ref.closeChannel:
ref.Debug("Canceling error h... | go | func (ref *Consumer) manualErrorHandler(in <-chan *sarama.ConsumerError) {
ref.Debug("errorHandler started ...")
for {
select {
case err, more := <-in:
if more {
ref.Errorf("message error: %T, %v", err, err)
ref.Config.RecvErrorChan <- err
}
case <-ref.closeChannel:
ref.Debug("Canceling error h... | [
"func",
"(",
"ref",
"*",
"Consumer",
")",
"manualErrorHandler",
"(",
"in",
"<-",
"chan",
"*",
"sarama",
".",
"ConsumerError",
")",
"{",
"ref",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"for",
"{",
"select",
"{",
"case",
"err",
",",
"more",
":=",
"<... | // manualErrorHandler processes each error message for partition consumer | [
"manualErrorHandler",
"processes",
"each",
"error",
"message",
"for",
"partition",
"consumer"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/client/consumer.go#L309-L323 |
126,578 | ligato/cn-infra | messaging/kafka/client/consumer.go | errorHandler | func (ref *Consumer) errorHandler(in <-chan error) {
ref.Debug("errorHandler started ...")
for {
select {
case err, more := <-in:
if more {
ref.Errorf("message error: %T, %v", err, err)
ref.Config.RecvErrorChan <- err
}
case <-ref.closeChannel:
ref.Debug("Canceling error handler")
return
}... | go | func (ref *Consumer) errorHandler(in <-chan error) {
ref.Debug("errorHandler started ...")
for {
select {
case err, more := <-in:
if more {
ref.Errorf("message error: %T, %v", err, err)
ref.Config.RecvErrorChan <- err
}
case <-ref.closeChannel:
ref.Debug("Canceling error handler")
return
}... | [
"func",
"(",
"ref",
"*",
"Consumer",
")",
"errorHandler",
"(",
"in",
"<-",
"chan",
"error",
")",
"{",
"ref",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"for",
"{",
"select",
"{",
"case",
"err",
",",
"more",
":=",
"<-",
"in",
":",
"if",
"more",
"... | // errorHandler processes each error message | [
"errorHandler",
"processes",
"each",
"error",
"message"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/client/consumer.go#L326-L340 |
126,579 | ligato/cn-infra | messaging/kafka/client/consumer.go | notificationHandler | func (ref *Consumer) notificationHandler(in <-chan *cluster.Notification) {
ref.Debug("NotificationHandler started ...")
for {
select {
case note := <-in:
ref.Config.RecvNotificationChan <- note
case <-ref.closeChannel:
ref.Debug("Canceling notification handler")
return
}
}
} | go | func (ref *Consumer) notificationHandler(in <-chan *cluster.Notification) {
ref.Debug("NotificationHandler started ...")
for {
select {
case note := <-in:
ref.Config.RecvNotificationChan <- note
case <-ref.closeChannel:
ref.Debug("Canceling notification handler")
return
}
}
} | [
"func",
"(",
"ref",
"*",
"Consumer",
")",
"notificationHandler",
"(",
"in",
"<-",
"chan",
"*",
"cluster",
".",
"Notification",
")",
"{",
"ref",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n\n",
"for",
"{",
"select",
"{",
"case",
"note",
":=",
"<-",
"in",
... | // NotificationHandler processes each message received when the consumer is rebalanced | [
"NotificationHandler",
"processes",
"each",
"message",
"received",
"when",
"the",
"consumer",
"is",
"rebalanced"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/client/consumer.go#L343-L355 |
126,580 | ligato/cn-infra | db/keyval/bolt/bolt.go | NewClient | func NewClient(cfg *Config) (client *Client, err error) {
db, err := bolt.Open(cfg.DbPath, cfg.FileMode, &bolt.Options{
Timeout: cfg.LockTimeout,
})
if err != nil {
return nil, err
}
boltLogger.Infof("bolt path: %v", db.Path())
err = db.Update(func(tx *bolt.Tx) error {
_, err := tx.CreateBucketIfNotExists(... | go | func NewClient(cfg *Config) (client *Client, err error) {
db, err := bolt.Open(cfg.DbPath, cfg.FileMode, &bolt.Options{
Timeout: cfg.LockTimeout,
})
if err != nil {
return nil, err
}
boltLogger.Infof("bolt path: %v", db.Path())
err = db.Update(func(tx *bolt.Tx) error {
_, err := tx.CreateBucketIfNotExists(... | [
"func",
"NewClient",
"(",
"cfg",
"*",
"Config",
")",
"(",
"client",
"*",
"Client",
",",
"err",
"error",
")",
"{",
"db",
",",
"err",
":=",
"bolt",
".",
"Open",
"(",
"cfg",
".",
"DbPath",
",",
"cfg",
".",
"FileMode",
",",
"&",
"bolt",
".",
"Options... | // NewClient creates new client for Bolt using given config. | [
"NewClient",
"creates",
"new",
"client",
"for",
"Bolt",
"using",
"given",
"config",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/bolt/bolt.go#L59-L87 |
126,581 | ligato/cn-infra | db/keyval/bolt/bolt.go | Close | func (c *Client) Close() error {
close(c.quit)
c.wg.Wait()
return c.db.Close()
} | go | func (c *Client) Close() error {
close(c.quit)
c.wg.Wait()
return c.db.Close()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"Close",
"(",
")",
"error",
"{",
"close",
"(",
"c",
".",
"quit",
")",
"\n",
"c",
".",
"wg",
".",
"Wait",
"(",
")",
"\n",
"return",
"c",
".",
"db",
".",
"Close",
"(",
")",
"\n",
"}"
] | // Close closes Bolt database. | [
"Close",
"closes",
"Bolt",
"database",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/bolt/bolt.go#L90-L94 |
126,582 | ligato/cn-infra | db/keyval/bolt/bolt.go | GetValue | func (c *Client) GetValue(key string) (data []byte, found bool, revision int64, err error) {
boltLogger.Debugf("GetValue: %q", key)
err = c.db.View(func(tx *bolt.Tx) error {
value := tx.Bucket(rootBucket).Get([]byte(key))
if value == nil {
return fmt.Errorf("value for key %q not found in bucket", key)
}
... | go | func (c *Client) GetValue(key string) (data []byte, found bool, revision int64, err error) {
boltLogger.Debugf("GetValue: %q", key)
err = c.db.View(func(tx *bolt.Tx) error {
value := tx.Bucket(rootBucket).Get([]byte(key))
if value == nil {
return fmt.Errorf("value for key %q not found in bucket", key)
}
... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetValue",
"(",
"key",
"string",
")",
"(",
"data",
"[",
"]",
"byte",
",",
"found",
"bool",
",",
"revision",
"int64",
",",
"err",
"error",
")",
"{",
"boltLogger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"key",
"... | // GetValue returns data for the given key | [
"GetValue",
"returns",
"data",
"for",
"the",
"given",
"key"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/bolt/bolt.go#L97-L112 |
126,583 | ligato/cn-infra | db/keyval/bolt/bolt.go | Put | func (c *Client) Put(key string, data []byte, opts ...datasync.PutOption) (err error) {
boltLogger.Debugf("Put: %q (len=%d)", key, len(data))
prevVal, err := c.safeUpdate(&update{
key: []byte(key),
value: data,
})
if err != nil {
return err
}
c.bumpWatchers(&watchEvent{
Key: key,
Value: da... | go | func (c *Client) Put(key string, data []byte, opts ...datasync.PutOption) (err error) {
boltLogger.Debugf("Put: %q (len=%d)", key, len(data))
prevVal, err := c.safeUpdate(&update{
key: []byte(key),
value: data,
})
if err != nil {
return err
}
c.bumpWatchers(&watchEvent{
Key: key,
Value: da... | [
"func",
"(",
"c",
"*",
"Client",
")",
"Put",
"(",
"key",
"string",
",",
"data",
"[",
"]",
"byte",
",",
"opts",
"...",
"datasync",
".",
"PutOption",
")",
"(",
"err",
"error",
")",
"{",
"boltLogger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"key",
",",... | // Put stores given data for the key | [
"Put",
"stores",
"given",
"data",
"for",
"the",
"key"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/bolt/bolt.go#L115-L134 |
126,584 | ligato/cn-infra | db/keyval/bolt/bolt.go | Delete | func (c *Client) Delete(key string, opts ...datasync.DelOption) (existed bool, err error) {
boltLogger.Debugf("Delete: %q", key)
prevVal, err := c.safeUpdate(&update{
key: []byte(key),
value: nil,
})
if err != nil {
return false, err
}
existed = prevVal != nil
c.bumpWatchers(&watchEvent{
Key: k... | go | func (c *Client) Delete(key string, opts ...datasync.DelOption) (existed bool, err error) {
boltLogger.Debugf("Delete: %q", key)
prevVal, err := c.safeUpdate(&update{
key: []byte(key),
value: nil,
})
if err != nil {
return false, err
}
existed = prevVal != nil
c.bumpWatchers(&watchEvent{
Key: k... | [
"func",
"(",
"c",
"*",
"Client",
")",
"Delete",
"(",
"key",
"string",
",",
"opts",
"...",
"datasync",
".",
"DelOption",
")",
"(",
"existed",
"bool",
",",
"err",
"error",
")",
"{",
"boltLogger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"key",
")",
"\n\n... | // Delete deletes given key | [
"Delete",
"deletes",
"given",
"key"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/bolt/bolt.go#L137-L156 |
126,585 | ligato/cn-infra | db/keyval/bolt/bolt.go | ListKeys | func (c *Client) ListKeys(keyPrefix string) (keyval.BytesKeyIterator, error) {
boltLogger.Debugf("ListKeys: %q", keyPrefix)
var keys []string
err := c.db.View(func(tx *bolt.Tx) error {
c := tx.Bucket(rootBucket).Cursor()
prefix := []byte(keyPrefix)
for k, _ := c.Seek(prefix); k != nil && bytes.HasPrefix(k, p... | go | func (c *Client) ListKeys(keyPrefix string) (keyval.BytesKeyIterator, error) {
boltLogger.Debugf("ListKeys: %q", keyPrefix)
var keys []string
err := c.db.View(func(tx *bolt.Tx) error {
c := tx.Bucket(rootBucket).Cursor()
prefix := []byte(keyPrefix)
for k, _ := c.Seek(prefix); k != nil && bytes.HasPrefix(k, p... | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListKeys",
"(",
"keyPrefix",
"string",
")",
"(",
"keyval",
".",
"BytesKeyIterator",
",",
"error",
")",
"{",
"boltLogger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"keyPrefix",
")",
"\n\n",
"var",
"keys",
"[",
"]",
"... | // ListKeys returns iterator with keys for given key prefix | [
"ListKeys",
"returns",
"iterator",
"with",
"keys",
"for",
"given",
"key",
"prefix"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/bolt/bolt.go#L159-L176 |
126,586 | ligato/cn-infra | db/keyval/bolt/bolt.go | ListValues | func (c *Client) ListValues(keyPrefix string) (keyval.BytesKeyValIterator, error) {
boltLogger.Debugf("ListValues: %q", keyPrefix)
var pairs []*kvPair
err := c.db.View(func(tx *bolt.Tx) error {
c := tx.Bucket(rootBucket).Cursor()
prefix := []byte(keyPrefix)
for k, v := c.Seek(prefix); k != nil && bytes.HasPr... | go | func (c *Client) ListValues(keyPrefix string) (keyval.BytesKeyValIterator, error) {
boltLogger.Debugf("ListValues: %q", keyPrefix)
var pairs []*kvPair
err := c.db.View(func(tx *bolt.Tx) error {
c := tx.Bucket(rootBucket).Cursor()
prefix := []byte(keyPrefix)
for k, v := c.Seek(prefix); k != nil && bytes.HasPr... | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListValues",
"(",
"keyPrefix",
"string",
")",
"(",
"keyval",
".",
"BytesKeyValIterator",
",",
"error",
")",
"{",
"boltLogger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"keyPrefix",
")",
"\n\n",
"var",
"pairs",
"[",
"]... | // ListValues returns iterator with key-value pairs for given key prefix | [
"ListValues",
"returns",
"iterator",
"with",
"key",
"-",
"value",
"pairs",
"for",
"given",
"key",
"prefix"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/bolt/bolt.go#L179-L200 |
126,587 | ligato/cn-infra | messaging/kafka/client/asyncproducer.go | SendMsgByte | func (ref *AsyncProducer) SendMsgByte(topic string, key []byte, msg []byte, metadata interface{}) {
// generate key if none supplied - used by Hash partitioner
if key == nil || len(key) == 0 {
md5Sum := fmt.Sprintf("%x", md5.Sum(msg))
ref.SendMsgToPartition(topic, ref.Partition, sarama.ByteEncoder([]byte(md5Sum))... | go | func (ref *AsyncProducer) SendMsgByte(topic string, key []byte, msg []byte, metadata interface{}) {
// generate key if none supplied - used by Hash partitioner
if key == nil || len(key) == 0 {
md5Sum := fmt.Sprintf("%x", md5.Sum(msg))
ref.SendMsgToPartition(topic, ref.Partition, sarama.ByteEncoder([]byte(md5Sum))... | [
"func",
"(",
"ref",
"*",
"AsyncProducer",
")",
"SendMsgByte",
"(",
"topic",
"string",
",",
"key",
"[",
"]",
"byte",
",",
"msg",
"[",
"]",
"byte",
",",
"metadata",
"interface",
"{",
"}",
")",
"{",
"// generate key if none supplied - used by Hash partitioner",
"... | // SendMsgByte sends an async message to Kafka. | [
"SendMsgByte",
"sends",
"an",
"async",
"message",
"to",
"Kafka",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/client/asyncproducer.go#L115-L123 |
126,588 | ligato/cn-infra | messaging/kafka/client/asyncproducer.go | SendMsgToPartition | func (ref *AsyncProducer) SendMsgToPartition(topic string, partition int32, key Encoder, msg Encoder, metadata interface{}) {
if msg == nil {
return
}
message := &sarama.ProducerMessage{
Topic: topic,
Partition: partition,
Key: key,
Value: msg,
Metadata: metadata,
}
ref.Producer.Input(... | go | func (ref *AsyncProducer) SendMsgToPartition(topic string, partition int32, key Encoder, msg Encoder, metadata interface{}) {
if msg == nil {
return
}
message := &sarama.ProducerMessage{
Topic: topic,
Partition: partition,
Key: key,
Value: msg,
Metadata: metadata,
}
ref.Producer.Input(... | [
"func",
"(",
"ref",
"*",
"AsyncProducer",
")",
"SendMsgToPartition",
"(",
"topic",
"string",
",",
"partition",
"int32",
",",
"key",
"Encoder",
",",
"msg",
"Encoder",
",",
"metadata",
"interface",
"{",
"}",
")",
"{",
"if",
"msg",
"==",
"nil",
"{",
"return... | // SendMsgToPartition sends an async message to Kafka | [
"SendMsgToPartition",
"sends",
"an",
"async",
"message",
"to",
"Kafka"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/client/asyncproducer.go#L126-L144 |
126,589 | ligato/cn-infra | messaging/kafka/client/asyncproducer.go | successHandler | func (ref *AsyncProducer) successHandler(in <-chan *sarama.ProducerMessage) {
ref.Debug("starting success handler ...")
for {
select {
case <-ref.closeChannel:
ref.Debug("success handler exited ...")
return
case msg := <-in:
if msg == nil {
continue
}
ref.Debugf("Message is stored in topic(%s... | go | func (ref *AsyncProducer) successHandler(in <-chan *sarama.ProducerMessage) {
ref.Debug("starting success handler ...")
for {
select {
case <-ref.closeChannel:
ref.Debug("success handler exited ...")
return
case msg := <-in:
if msg == nil {
continue
}
ref.Debugf("Message is stored in topic(%s... | [
"func",
"(",
"ref",
"*",
"AsyncProducer",
")",
"successHandler",
"(",
"in",
"<-",
"chan",
"*",
"sarama",
".",
"ProducerMessage",
")",
"{",
"ref",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"for",
"{",
"select",
"{",
"case",
"<-",
"ref",
".",
"closeCha... | // successHandler handles success messages | [
"successHandler",
"handles",
"success",
"messages"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/client/asyncproducer.go#L192-L215 |
126,590 | ligato/cn-infra | messaging/kafka/client/asyncproducer.go | errorHandler | func (ref *AsyncProducer) errorHandler(in <-chan *sarama.ProducerError) {
ref.Debug("starting error handler ...")
for {
select {
case <-ref.closeChannel:
ref.Debug("error handler exited ...")
return
case perr := <-in:
if perr == nil {
continue
}
msg := perr.Msg
err := perr.Err
pmsg := ... | go | func (ref *AsyncProducer) errorHandler(in <-chan *sarama.ProducerError) {
ref.Debug("starting error handler ...")
for {
select {
case <-ref.closeChannel:
ref.Debug("error handler exited ...")
return
case perr := <-in:
if perr == nil {
continue
}
msg := perr.Msg
err := perr.Err
pmsg := ... | [
"func",
"(",
"ref",
"*",
"AsyncProducer",
")",
"errorHandler",
"(",
"in",
"<-",
"chan",
"*",
"sarama",
".",
"ProducerError",
")",
"{",
"ref",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"for",
"{",
"select",
"{",
"case",
"<-",
"ref",
".",
"closeChannel... | // errorHandler handles error messages | [
"errorHandler",
"handles",
"error",
"messages"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/client/asyncproducer.go#L218-L250 |
126,591 | ligato/cn-infra | config/plugin_config.go | DefineDirFlag | func DefineDirFlag() {
if flag.CommandLine.Lookup(DirFlag) == nil {
flag.CommandLine.String(DirFlag, DirDefault, DirUsage)
}
} | go | func DefineDirFlag() {
if flag.CommandLine.Lookup(DirFlag) == nil {
flag.CommandLine.String(DirFlag, DirDefault, DirUsage)
}
} | [
"func",
"DefineDirFlag",
"(",
")",
"{",
"if",
"flag",
".",
"CommandLine",
".",
"Lookup",
"(",
"DirFlag",
")",
"==",
"nil",
"{",
"flag",
".",
"CommandLine",
".",
"String",
"(",
"DirFlag",
",",
"DirDefault",
",",
"DirUsage",
")",
"\n",
"}",
"\n",
"}"
] | // DefineDirFlag defines flag for configuration directory. | [
"DefineDirFlag",
"defines",
"flag",
"for",
"configuration",
"directory",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/config/plugin_config.go#L55-L59 |
126,592 | ligato/cn-infra | config/plugin_config.go | DefineFlagsFor | func DefineFlagsFor(name string) {
if plugSet, ok := pluginFlags[name]; ok {
plugSet.VisitAll(func(f *flag.Flag) {
flag.CommandLine.Var(f.Value, f.Name, f.Usage)
})
}
} | go | func DefineFlagsFor(name string) {
if plugSet, ok := pluginFlags[name]; ok {
plugSet.VisitAll(func(f *flag.Flag) {
flag.CommandLine.Var(f.Value, f.Name, f.Usage)
})
}
} | [
"func",
"DefineFlagsFor",
"(",
"name",
"string",
")",
"{",
"if",
"plugSet",
",",
"ok",
":=",
"pluginFlags",
"[",
"name",
"]",
";",
"ok",
"{",
"plugSet",
".",
"VisitAll",
"(",
"func",
"(",
"f",
"*",
"flag",
".",
"Flag",
")",
"{",
"flag",
".",
"Comma... | // DefineFlagsFor registers defined flags for plugin with given name. | [
"DefineFlagsFor",
"registers",
"defined",
"flags",
"for",
"plugin",
"with",
"given",
"name",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/config/plugin_config.go#L82-L88 |
126,593 | ligato/cn-infra | config/plugin_config.go | WithExtraFlags | func WithExtraFlags(f func(flags *FlagSet)) Option {
return func(o *options) {
f(o.flagSet)
}
} | go | func WithExtraFlags(f func(flags *FlagSet)) Option {
return func(o *options) {
f(o.flagSet)
}
} | [
"func",
"WithExtraFlags",
"(",
"f",
"func",
"(",
"flags",
"*",
"FlagSet",
")",
")",
"Option",
"{",
"return",
"func",
"(",
"o",
"*",
"options",
")",
"{",
"f",
"(",
"o",
".",
"flagSet",
")",
"\n",
"}",
"\n",
"}"
] | // WithExtraFlags is an option to define additional flags for plugin in ForPlugin. | [
"WithExtraFlags",
"is",
"an",
"option",
"to",
"define",
"additional",
"flags",
"for",
"plugin",
"in",
"ForPlugin",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/config/plugin_config.go#L118-L122 |
126,594 | ligato/cn-infra | config/plugin_config.go | Dir | func Dir() (dir string, err error) {
if flg := flag.CommandLine.Lookup(DirFlag); flg != nil {
val := flg.Value.String()
if strings.HasPrefix(val, ".") {
cwd, err := os.Getwd()
if err != nil {
return cwd, err
}
return filepath.Join(cwd, val), nil
}
return val, nil
}
return "", nil
} | go | func Dir() (dir string, err error) {
if flg := flag.CommandLine.Lookup(DirFlag); flg != nil {
val := flg.Value.String()
if strings.HasPrefix(val, ".") {
cwd, err := os.Getwd()
if err != nil {
return cwd, err
}
return filepath.Join(cwd, val), nil
}
return val, nil
}
return "", nil
} | [
"func",
"Dir",
"(",
")",
"(",
"dir",
"string",
",",
"err",
"error",
")",
"{",
"if",
"flg",
":=",
"flag",
".",
"CommandLine",
".",
"Lookup",
"(",
"DirFlag",
")",
";",
"flg",
"!=",
"nil",
"{",
"val",
":=",
"flg",
".",
"Value",
".",
"String",
"(",
... | // Dir returns config directory by evaluating the flag DirFlag. It interprets "." as current working directory. | [
"Dir",
"returns",
"config",
"directory",
"by",
"evaluating",
"the",
"flag",
"DirFlag",
".",
"It",
"interprets",
".",
"as",
"current",
"working",
"directory",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/config/plugin_config.go#L154-L167 |
126,595 | ligato/cn-infra | config/plugin_config.go | LoadValue | func (p *pluginConfig) LoadValue(config interface{}) (found bool, err error) {
cfgName := p.GetConfigName()
if cfgName == "" {
return false, nil
}
// TODO: switch to Viper (possible to have one huge config file)
err = ParseConfigFromYamlFile(cfgName, config)
if err != nil {
return false, err
}
return true... | go | func (p *pluginConfig) LoadValue(config interface{}) (found bool, err error) {
cfgName := p.GetConfigName()
if cfgName == "" {
return false, nil
}
// TODO: switch to Viper (possible to have one huge config file)
err = ParseConfigFromYamlFile(cfgName, config)
if err != nil {
return false, err
}
return true... | [
"func",
"(",
"p",
"*",
"pluginConfig",
")",
"LoadValue",
"(",
"config",
"interface",
"{",
"}",
")",
"(",
"found",
"bool",
",",
"err",
"error",
")",
"{",
"cfgName",
":=",
"p",
".",
"GetConfigName",
"(",
")",
"\n",
"if",
"cfgName",
"==",
"\"",
"\"",
... | // LoadValue binds the configuration to config method argument. | [
"LoadValue",
"binds",
"the",
"configuration",
"to",
"config",
"method",
"argument",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/config/plugin_config.go#L176-L189 |
126,596 | ligato/cn-infra | db/keyval/filedb/decoder/mock_decoder.go | NewDecoderMock | func NewDecoderMock() *Mock {
return &Mock{
responses: make([]*WhenResp, 0),
eventChan: make(chan fsnotify.Event),
}
} | go | func NewDecoderMock() *Mock {
return &Mock{
responses: make([]*WhenResp, 0),
eventChan: make(chan fsnotify.Event),
}
} | [
"func",
"NewDecoderMock",
"(",
")",
"*",
"Mock",
"{",
"return",
"&",
"Mock",
"{",
"responses",
":",
"make",
"(",
"[",
"]",
"*",
"WhenResp",
",",
"0",
")",
",",
"eventChan",
":",
"make",
"(",
"chan",
"fsnotify",
".",
"Event",
")",
",",
"}",
"\n",
... | // NewDecoderMock creates new instance of the mock and initializes response list | [
"NewDecoderMock",
"creates",
"new",
"instance",
"of",
"the",
"mock",
"and",
"initializes",
"response",
"list"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/filedb/decoder/mock_decoder.go#L28-L33 |
126,597 | ligato/cn-infra | db/keyval/filedb/decoder/mock_decoder.go | When | func (mock *Mock) When(methodName string) *WhenResp {
resp := &WhenResp{
methodName: methodName,
}
mock.responses = append(mock.responses, resp)
return resp
} | go | func (mock *Mock) When(methodName string) *WhenResp {
resp := &WhenResp{
methodName: methodName,
}
mock.responses = append(mock.responses, resp)
return resp
} | [
"func",
"(",
"mock",
"*",
"Mock",
")",
"When",
"(",
"methodName",
"string",
")",
"*",
"WhenResp",
"{",
"resp",
":=",
"&",
"WhenResp",
"{",
"methodName",
":",
"methodName",
",",
"}",
"\n",
"mock",
".",
"responses",
"=",
"append",
"(",
"mock",
".",
"re... | // When defines name of the related method. It creates a new instance of WhenResp with provided method name and
// stores it to the mock. | [
"When",
"defines",
"name",
"of",
"the",
"related",
"method",
".",
"It",
"creates",
"a",
"new",
"instance",
"of",
"WhenResp",
"with",
"provided",
"method",
"name",
"and",
"stores",
"it",
"to",
"the",
"mock",
"."
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/filedb/decoder/mock_decoder.go#L43-L49 |
126,598 | ligato/cn-infra | db/keyval/filedb/decoder/mock_decoder.go | getReturnValues | func (mock *Mock) getReturnValues(name string) (response []interface{}) {
for i, resp := range mock.responses {
if resp.methodName == name {
// Remove used response but retain order
mock.responses = append(mock.responses[:i], mock.responses[i+1:]...)
return resp.items
}
}
// Return empty response
retur... | go | func (mock *Mock) getReturnValues(name string) (response []interface{}) {
for i, resp := range mock.responses {
if resp.methodName == name {
// Remove used response but retain order
mock.responses = append(mock.responses[:i], mock.responses[i+1:]...)
return resp.items
}
}
// Return empty response
retur... | [
"func",
"(",
"mock",
"*",
"Mock",
")",
"getReturnValues",
"(",
"name",
"string",
")",
"(",
"response",
"[",
"]",
"interface",
"{",
"}",
")",
"{",
"for",
"i",
",",
"resp",
":=",
"range",
"mock",
".",
"responses",
"{",
"if",
"resp",
".",
"methodName",
... | // Auxiliary method returns next return value for provided method as generic type | [
"Auxiliary",
"method",
"returns",
"next",
"return",
"value",
"for",
"provided",
"method",
"as",
"generic",
"type"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/filedb/decoder/mock_decoder.go#L68-L78 |
126,599 | ligato/cn-infra | db/keyval/filedb/decoder/mock_decoder.go | IsProcessable | func (mock *Mock) IsProcessable(file string) bool {
items := mock.getReturnValues("IsProcessable")
return items[0].(bool)
} | go | func (mock *Mock) IsProcessable(file string) bool {
items := mock.getReturnValues("IsProcessable")
return items[0].(bool)
} | [
"func",
"(",
"mock",
"*",
"Mock",
")",
"IsProcessable",
"(",
"file",
"string",
")",
"bool",
"{",
"items",
":=",
"mock",
".",
"getReturnValues",
"(",
"\"",
"\"",
")",
"\n",
"return",
"items",
"[",
"0",
"]",
".",
"(",
"bool",
")",
"\n",
"}"
] | // IsProcessable mocks original method | [
"IsProcessable",
"mocks",
"original",
"method"
] | 6552f4407e293b0986ec353eb0f01968cbecb928 | https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/filedb/decoder/mock_decoder.go#L81-L84 |
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.