id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
20,500
trivago/gollum
core/messagehelper.go
GetAppliedContentGetFunction
func GetAppliedContentGetFunction(applyTo string) GetAppliedContent { if applyTo != "" { return func(msg *Message) []byte { metadata := msg.TryGetMetadata() if metadata == nil { return []byte{} } return metadata.GetValue(applyTo) } } return func(msg *Message) []byte { return msg.GetPayload() ...
go
func GetAppliedContentGetFunction(applyTo string) GetAppliedContent { if applyTo != "" { return func(msg *Message) []byte { metadata := msg.TryGetMetadata() if metadata == nil { return []byte{} } return metadata.GetValue(applyTo) } } return func(msg *Message) []byte { return msg.GetPayload() ...
[ "func", "GetAppliedContentGetFunction", "(", "applyTo", "string", ")", "GetAppliedContent", "{", "if", "applyTo", "!=", "\"", "\"", "{", "return", "func", "(", "msg", "*", "Message", ")", "[", "]", "byte", "{", "metadata", ":=", "msg", ".", "TryGetMetadata",...
// GetAppliedContentGetFunction returns a GetAppliedContent function
[ "GetAppliedContentGetFunction", "returns", "a", "GetAppliedContent", "function" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/messagehelper.go#L11-L25
20,501
trivago/gollum
core/messagehelper.go
GetAppliedContentSetFunction
func GetAppliedContentSetFunction(applyTo string) SetAppliedContent { if applyTo != "" { return func(msg *Message, content []byte) { if content == nil { msg.GetMetadata().Delete(applyTo) } else { msg.GetMetadata().SetValue(applyTo, content) } } } return func(msg *Message, content []byte) { if...
go
func GetAppliedContentSetFunction(applyTo string) SetAppliedContent { if applyTo != "" { return func(msg *Message, content []byte) { if content == nil { msg.GetMetadata().Delete(applyTo) } else { msg.GetMetadata().SetValue(applyTo, content) } } } return func(msg *Message, content []byte) { if...
[ "func", "GetAppliedContentSetFunction", "(", "applyTo", "string", ")", "SetAppliedContent", "{", "if", "applyTo", "!=", "\"", "\"", "{", "return", "func", "(", "msg", "*", "Message", ",", "content", "[", "]", "byte", ")", "{", "if", "content", "==", "nil",...
// GetAppliedContentSetFunction returns SetAppliedContent function to store message content
[ "GetAppliedContentSetFunction", "returns", "SetAppliedContent", "function", "to", "store", "message", "content" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/messagehelper.go#L28-L46
20,502
trivago/gollum
core/components/rotateConfig.go
NewRotateConfig
func NewRotateConfig() RotateConfig { return RotateConfig{ Enabled: false, Timeout: 1440, SizeByte: 1024, Timestamp: "2006-01-02_15", ZeroPad: 0, Compress: false, AtHour: -1, AtMinute: -1, } }
go
func NewRotateConfig() RotateConfig { return RotateConfig{ Enabled: false, Timeout: 1440, SizeByte: 1024, Timestamp: "2006-01-02_15", ZeroPad: 0, Compress: false, AtHour: -1, AtMinute: -1, } }
[ "func", "NewRotateConfig", "(", ")", "RotateConfig", "{", "return", "RotateConfig", "{", "Enabled", ":", "false", ",", "Timeout", ":", "1440", ",", "SizeByte", ":", "1024", ",", "Timestamp", ":", "\"", "\"", ",", "ZeroPad", ":", "0", ",", "Compress", ":"...
// NewRotateConfig create and returns a RotateConfig with default settings
[ "NewRotateConfig", "create", "and", "returns", "a", "RotateConfig", "with", "default", "settings" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/components/rotateConfig.go#L67-L78
20,503
trivago/gollum
core/components/rotateConfig.go
Configure
func (rotate *RotateConfig) Configure(conf core.PluginConfigReader) { rotateAt := conf.GetString("Rotation/At", "") if rotateAt != "" { parts := strings.Split(rotateAt, ":") rotateAtHour, _ := strconv.ParseInt(parts[0], 10, 8) rotateAtMin, _ := strconv.ParseInt(parts[1], 10, 8) rotate.AtHour = int(rotateAtHo...
go
func (rotate *RotateConfig) Configure(conf core.PluginConfigReader) { rotateAt := conf.GetString("Rotation/At", "") if rotateAt != "" { parts := strings.Split(rotateAt, ":") rotateAtHour, _ := strconv.ParseInt(parts[0], 10, 8) rotateAtMin, _ := strconv.ParseInt(parts[1], 10, 8) rotate.AtHour = int(rotateAtHo...
[ "func", "(", "rotate", "*", "RotateConfig", ")", "Configure", "(", "conf", "core", ".", "PluginConfigReader", ")", "{", "rotateAt", ":=", "conf", ".", "GetString", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "rotateAt", "!=", "\"", "\"", "{", ...
// Configure method for interface implementation
[ "Configure", "method", "for", "interface", "implementation" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/components/rotateConfig.go#L81-L91
20,504
trivago/gollum
core/messagequeue.go
Push
func (channel MessageQueue) Push(msg *Message, timeout time.Duration) (state MessageQueueResult) { defer func() { // Treat closed channels like timeouts if recover() != nil { state = MessageQueueTimeout } }() if timeout == 0 { channel <- msg return MessageQueueOk // ### return, done ### } start := t...
go
func (channel MessageQueue) Push(msg *Message, timeout time.Duration) (state MessageQueueResult) { defer func() { // Treat closed channels like timeouts if recover() != nil { state = MessageQueueTimeout } }() if timeout == 0 { channel <- msg return MessageQueueOk // ### return, done ### } start := t...
[ "func", "(", "channel", "MessageQueue", ")", "Push", "(", "msg", "*", "Message", ",", "timeout", "time", ".", "Duration", ")", "(", "state", "MessageQueueResult", ")", "{", "defer", "func", "(", ")", "{", "// Treat closed channels like timeouts", "if", "recove...
// Push adds a message to the MessageStream. // waiting for a timeout instead of just blocking. // Passing a timeout of -1 will discard the message. // Passing a timout of 0 will always block. // Messages that time out will be passed to the sent to the fallback queue if a Dropped // consumer exists. // The source param...
[ "Push", "adds", "a", "message", "to", "the", "MessageStream", ".", "waiting", "for", "a", "timeout", "instead", "of", "just", "blocking", ".", "Passing", "a", "timeout", "of", "-", "1", "will", "discard", "the", "message", ".", "Passing", "a", "timout", ...
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/messagequeue.go#L50-L90
20,505
trivago/gollum
core/messagequeue.go
PopWithTimeout
func (channel MessageQueue) PopWithTimeout(maxDuration time.Duration) (*Message, bool) { timeout := time.NewTimer(maxDuration) select { case msg, more := <-channel: timeout.Stop() return msg, more case <-timeout.C: return nil, false } }
go
func (channel MessageQueue) PopWithTimeout(maxDuration time.Duration) (*Message, bool) { timeout := time.NewTimer(maxDuration) select { case msg, more := <-channel: timeout.Stop() return msg, more case <-timeout.C: return nil, false } }
[ "func", "(", "channel", "MessageQueue", ")", "PopWithTimeout", "(", "maxDuration", "time", ".", "Duration", ")", "(", "*", "Message", ",", "bool", ")", "{", "timeout", ":=", "time", ".", "NewTimer", "(", "maxDuration", ")", "\n", "select", "{", "case", "...
// PopWithTimeout returns a message from the buffer with a runtime <= maxDuration. // If the channel is empty or the timout hit, the second return value is false.
[ "PopWithTimeout", "returns", "a", "message", "from", "the", "buffer", "with", "a", "runtime", "<", "=", "maxDuration", ".", "If", "the", "channel", "is", "empty", "or", "the", "timout", "hit", "the", "second", "return", "value", "is", "false", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/messagequeue.go#L108-L117
20,506
trivago/gollum
core/messagequeue.go
Pop
func (channel MessageQueue) Pop() (*Message, bool) { msg, more := <-channel return msg, more }
go
func (channel MessageQueue) Pop() (*Message, bool) { msg, more := <-channel return msg, more }
[ "func", "(", "channel", "MessageQueue", ")", "Pop", "(", ")", "(", "*", "Message", ",", "bool", ")", "{", "msg", ",", "more", ":=", "<-", "channel", "\n", "return", "msg", ",", "more", "\n", "}" ]
// Pop returns a message from the buffer
[ "Pop", "returns", "a", "message", "from", "the", "buffer" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/messagequeue.go#L120-L123
20,507
trivago/gollum
core/messagetracer.go
ActivateMessageTrace
func ActivateMessageTrace() { MessageTrace = func(msg *Message, pluginID string, comment string) { mt := messageTracer{ msg: msg, pluginID: pluginID, } mt.Dump(comment) } }
go
func ActivateMessageTrace() { MessageTrace = func(msg *Message, pluginID string, comment string) { mt := messageTracer{ msg: msg, pluginID: pluginID, } mt.Dump(comment) } }
[ "func", "ActivateMessageTrace", "(", ")", "{", "MessageTrace", "=", "func", "(", "msg", "*", "Message", ",", "pluginID", "string", ",", "comment", "string", ")", "{", "mt", ":=", "messageTracer", "{", "msg", ":", "msg", ",", "pluginID", ":", "pluginID", ...
// ActivateMessageTrace set a MessageTrace function to dump out the message trace
[ "ActivateMessageTrace", "set", "a", "MessageTrace", "function", "to", "dump", "out", "the", "message", "trace" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/messagetracer.go#L70-L79
20,508
trivago/gollum
core/messagetracer.go
Dump
func (mt *messageTracer) Dump(comment string) { if mt.msg.streamID == LogInternalStreamID || mt.msg.streamID == TraceInternalStreamID { return } var err error msgDump := mt.newMessageDump(mt.msg, comment) if StreamRegistry.IsStreamRegistered(TraceInternalStreamID) { err = mt.routeToTraceStream(msgDump) } e...
go
func (mt *messageTracer) Dump(comment string) { if mt.msg.streamID == LogInternalStreamID || mt.msg.streamID == TraceInternalStreamID { return } var err error msgDump := mt.newMessageDump(mt.msg, comment) if StreamRegistry.IsStreamRegistered(TraceInternalStreamID) { err = mt.routeToTraceStream(msgDump) } e...
[ "func", "(", "mt", "*", "messageTracer", ")", "Dump", "(", "comment", "string", ")", "{", "if", "mt", ".", "msg", ".", "streamID", "==", "LogInternalStreamID", "||", "mt", ".", "msg", ".", "streamID", "==", "TraceInternalStreamID", "{", "return", "\n", "...
// Dump creates a messageDump struct for the message trace
[ "Dump", "creates", "a", "messageDump", "struct", "for", "the", "message", "trace" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/messagetracer.go#L88-L106
20,509
trivago/gollum
producer/file/targetFile.go
NewTargetFile
func NewTargetFile(fileDir, fileName, fileExt string, permissions os.FileMode) TargetFile { return TargetFile{ fileDir, fileName, fileExt, fmt.Sprintf("%s/%s%s", fileDir, fileName, fileExt), permissions, } }
go
func NewTargetFile(fileDir, fileName, fileExt string, permissions os.FileMode) TargetFile { return TargetFile{ fileDir, fileName, fileExt, fmt.Sprintf("%s/%s%s", fileDir, fileName, fileExt), permissions, } }
[ "func", "NewTargetFile", "(", "fileDir", ",", "fileName", ",", "fileExt", "string", ",", "permissions", "os", ".", "FileMode", ")", "TargetFile", "{", "return", "TargetFile", "{", "fileDir", ",", "fileName", ",", "fileExt", ",", "fmt", ".", "Sprintf", "(", ...
// NewTargetFile returns a new TargetFile instance
[ "NewTargetFile", "returns", "a", "new", "TargetFile", "instance" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/producer/file/targetFile.go#L38-L46
20,510
trivago/gollum
producer/file/targetFile.go
GetFinalPath
func (streamFile *TargetFile) GetFinalPath(rotate components.RotateConfig) string { return fmt.Sprintf("%s/%s", streamFile.dir, streamFile.GetFinalName(rotate)) }
go
func (streamFile *TargetFile) GetFinalPath(rotate components.RotateConfig) string { return fmt.Sprintf("%s/%s", streamFile.dir, streamFile.GetFinalName(rotate)) }
[ "func", "(", "streamFile", "*", "TargetFile", ")", "GetFinalPath", "(", "rotate", "components", ".", "RotateConfig", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "streamFile", ".", "dir", ",", "streamFile", ".", "GetFinalName", ...
// GetFinalPath returns the final file path with possible rotations
[ "GetFinalPath", "returns", "the", "final", "file", "path", "with", "possible", "rotations" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/producer/file/targetFile.go#L54-L56
20,511
trivago/gollum
producer/file/targetFile.go
GetFinalName
func (streamFile *TargetFile) GetFinalName(rotate components.RotateConfig) string { var logFileName string // Generate the log filename based on rotation, existing files, etc. if !rotate.Enabled { logFileName = fmt.Sprintf("%s%s", streamFile.name, streamFile.ext) } else { timestamp := time.Now().Format(rotate....
go
func (streamFile *TargetFile) GetFinalName(rotate components.RotateConfig) string { var logFileName string // Generate the log filename based on rotation, existing files, etc. if !rotate.Enabled { logFileName = fmt.Sprintf("%s%s", streamFile.name, streamFile.ext) } else { timestamp := time.Now().Format(rotate....
[ "func", "(", "streamFile", "*", "TargetFile", ")", "GetFinalName", "(", "rotate", "components", ".", "RotateConfig", ")", "string", "{", "var", "logFileName", "string", "\n\n", "// Generate the log filename based on rotation, existing files, etc.", "if", "!", "rotate", ...
// GetFinalName returns the final file name with possible rotations
[ "GetFinalName", "returns", "the", "final", "file", "name", "with", "possible", "rotations" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/producer/file/targetFile.go#L59-L100
20,512
trivago/gollum
producer/file/targetFile.go
GetDir
func (streamFile *TargetFile) GetDir() (string, error) { // Assure path is existing if err := os.MkdirAll(streamFile.dir, streamFile.folderPermissions); err != nil { return "", fmt.Errorf("failed to create %s because of %s", streamFile.dir, err.Error()) } return streamFile.dir, nil }
go
func (streamFile *TargetFile) GetDir() (string, error) { // Assure path is existing if err := os.MkdirAll(streamFile.dir, streamFile.folderPermissions); err != nil { return "", fmt.Errorf("failed to create %s because of %s", streamFile.dir, err.Error()) } return streamFile.dir, nil }
[ "func", "(", "streamFile", "*", "TargetFile", ")", "GetDir", "(", ")", "(", "string", ",", "error", ")", "{", "// Assure path is existing", "if", "err", ":=", "os", ".", "MkdirAll", "(", "streamFile", ".", "dir", ",", "streamFile", ".", "folderPermissions", ...
// GetDir create file directory if it not exists and returns the dir name
[ "GetDir", "create", "file", "directory", "if", "it", "not", "exists", "and", "returns", "the", "dir", "name" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/producer/file/targetFile.go#L103-L110
20,513
trivago/gollum
producer/file/targetFile.go
GetSymlinkPath
func (streamFile *TargetFile) GetSymlinkPath() string { return fmt.Sprintf("%s/%s_current%s", streamFile.dir, streamFile.name, streamFile.ext) }
go
func (streamFile *TargetFile) GetSymlinkPath() string { return fmt.Sprintf("%s/%s_current%s", streamFile.dir, streamFile.name, streamFile.ext) }
[ "func", "(", "streamFile", "*", "TargetFile", ")", "GetSymlinkPath", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "streamFile", ".", "dir", ",", "streamFile", ".", "name", ",", "streamFile", ".", "ext", ")", "\n", "}"...
// GetSymlinkPath returns a symlink path for the current file
[ "GetSymlinkPath", "returns", "a", "symlink", "path", "for", "the", "current", "file" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/producer/file/targetFile.go#L113-L115
20,514
trivago/gollum
consumer/syslogd.go
Consume
func (cons *Syslogd) Consume(workers *sync.WaitGroup) { server := syslog.NewServer() server.SetFormat(cons.format) server.SetHandler(cons) switch cons.protocol { case "unix": if err := server.ListenUnixgram(cons.address); err != nil { if errRemove := os.Remove(cons.address); errRemove != nil { cons.Logge...
go
func (cons *Syslogd) Consume(workers *sync.WaitGroup) { server := syslog.NewServer() server.SetFormat(cons.format) server.SetHandler(cons) switch cons.protocol { case "unix": if err := server.ListenUnixgram(cons.address); err != nil { if errRemove := os.Remove(cons.address); errRemove != nil { cons.Logge...
[ "func", "(", "cons", "*", "Syslogd", ")", "Consume", "(", "workers", "*", "sync", ".", "WaitGroup", ")", "{", "server", ":=", "syslog", ".", "NewServer", "(", ")", "\n", "server", ".", "SetFormat", "(", "cons", ".", "format", ")", "\n", "server", "."...
// Consume opens a new syslog socket. // Messages are expected to be separated by \n.
[ "Consume", "opens", "a", "new", "syslog", "socket", ".", "Messages", "are", "expected", "to", "be", "separated", "by", "\\", "n", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/consumer/syslogd.go#L277-L311
20,515
trivago/gollum
core/pluginconfigreaderwitherror.go
GetLogger
func (reader PluginConfigReaderWithError) GetLogger() logrus.FieldLogger { return logrus.WithFields(logrus.Fields{ "PluginType": reader.config.Typename, "PluginID": reader.config.ID, }) }
go
func (reader PluginConfigReaderWithError) GetLogger() logrus.FieldLogger { return logrus.WithFields(logrus.Fields{ "PluginType": reader.config.Typename, "PluginID": reader.config.ID, }) }
[ "func", "(", "reader", "PluginConfigReaderWithError", ")", "GetLogger", "(", ")", "logrus", ".", "FieldLogger", "{", "return", "logrus", ".", "WithFields", "(", "logrus", ".", "Fields", "{", "\"", "\"", ":", "reader", ".", "config", ".", "Typename", ",", "...
// GetLogger creates a logger scoped for the plugin contained in this config.
[ "GetLogger", "creates", "a", "logger", "scoped", "for", "the", "plugin", "contained", "in", "this", "config", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/pluginconfigreaderwitherror.go#L43-L48
20,516
trivago/gollum
core/pluginconfigreaderwitherror.go
GetSubLogger
func (reader PluginConfigReaderWithError) GetSubLogger(subScope string) logrus.FieldLogger { return reader.GetLogger().WithField("Scope", subScope) }
go
func (reader PluginConfigReaderWithError) GetSubLogger(subScope string) logrus.FieldLogger { return reader.GetLogger().WithField("Scope", subScope) }
[ "func", "(", "reader", "PluginConfigReaderWithError", ")", "GetSubLogger", "(", "subScope", "string", ")", "logrus", ".", "FieldLogger", "{", "return", "reader", ".", "GetLogger", "(", ")", ".", "WithField", "(", "\"", "\"", ",", "subScope", ")", "\n", "}" ]
// GetSubLogger creates a logger scoped gor the plugin contained in this config, // with an additional subscope.
[ "GetSubLogger", "creates", "a", "logger", "scoped", "gor", "the", "plugin", "contained", "in", "this", "config", "with", "an", "additional", "subscope", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/pluginconfigreaderwitherror.go#L52-L54
20,517
trivago/gollum
core/pluginconfigreaderwitherror.go
GetString
func (reader PluginConfigReaderWithError) GetString(key string, defaultValue string) (string, error) { key = reader.config.registerKey(key) if reader.HasValue(key) { value, err := reader.config.Settings.String(key) return tstrings.Unescape(value), err } return defaultValue, nil }
go
func (reader PluginConfigReaderWithError) GetString(key string, defaultValue string) (string, error) { key = reader.config.registerKey(key) if reader.HasValue(key) { value, err := reader.config.Settings.String(key) return tstrings.Unescape(value), err } return defaultValue, nil }
[ "func", "(", "reader", "PluginConfigReaderWithError", ")", "GetString", "(", "key", "string", ",", "defaultValue", "string", ")", "(", "string", ",", "error", ")", "{", "key", "=", "reader", ".", "config", ".", "registerKey", "(", "key", ")", "\n", "if", ...
// GetString tries to read a string value from a PluginConfig. // If that value is not found defaultValue is returned.
[ "GetString", "tries", "to", "read", "a", "string", "value", "from", "a", "PluginConfig", ".", "If", "that", "value", "is", "not", "found", "defaultValue", "is", "returned", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/pluginconfigreaderwitherror.go#L76-L83
20,518
trivago/gollum
core/pluginconfigreaderwitherror.go
GetFloat
func (reader PluginConfigReaderWithError) GetFloat(key string, defaultValue float64) (float64, error) { key = reader.config.registerKey(key) if reader.HasValue(key) { return reader.config.Settings.Float(key) } return defaultValue, nil }
go
func (reader PluginConfigReaderWithError) GetFloat(key string, defaultValue float64) (float64, error) { key = reader.config.registerKey(key) if reader.HasValue(key) { return reader.config.Settings.Float(key) } return defaultValue, nil }
[ "func", "(", "reader", "PluginConfigReaderWithError", ")", "GetFloat", "(", "key", "string", ",", "defaultValue", "float64", ")", "(", "float64", ",", "error", ")", "{", "key", "=", "reader", ".", "config", ".", "registerKey", "(", "key", ")", "\n", "if", ...
// GetFloat tries to read a float value from a PluginConfig. // If that value is not found defaultValue is returned.
[ "GetFloat", "tries", "to", "read", "a", "float", "value", "from", "a", "PluginConfig", ".", "If", "that", "value", "is", "not", "found", "defaultValue", "is", "returned", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/pluginconfigreaderwitherror.go#L130-L136
20,519
trivago/gollum
core/pluginconfigreaderwitherror.go
GetStreamID
func (reader PluginConfigReaderWithError) GetStreamID(key string, defaultValue MessageStreamID) (MessageStreamID, error) { key = reader.config.registerKey(key) if reader.HasValue(key) { value, err := reader.config.Settings.String(key) if err != nil { return InvalidStreamID, err } return GetStreamID(value),...
go
func (reader PluginConfigReaderWithError) GetStreamID(key string, defaultValue MessageStreamID) (MessageStreamID, error) { key = reader.config.registerKey(key) if reader.HasValue(key) { value, err := reader.config.Settings.String(key) if err != nil { return InvalidStreamID, err } return GetStreamID(value),...
[ "func", "(", "reader", "PluginConfigReaderWithError", ")", "GetStreamID", "(", "key", "string", ",", "defaultValue", "MessageStreamID", ")", "(", "MessageStreamID", ",", "error", ")", "{", "key", "=", "reader", ".", "config", ".", "registerKey", "(", "key", ")...
// GetStreamID tries to read a StreamID value from a PluginConfig. // If that value is not found defaultValue is returned.
[ "GetStreamID", "tries", "to", "read", "a", "StreamID", "value", "from", "a", "PluginConfig", ".", "If", "that", "value", "is", "not", "found", "defaultValue", "is", "returned", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/pluginconfigreaderwitherror.go#L161-L171
20,520
trivago/gollum
core/pluginconfigreaderwitherror.go
GetModulatorArray
func (reader PluginConfigReaderWithError) GetModulatorArray(key string, logger logrus.FieldLogger, defaultValue ModulatorArray) (ModulatorArray, error) { modulators := []Modulator{} modPlugins, err := reader.GetPluginArray(key, []Plugin{}) if err != nil { return modulators, err } if len(modPlugins) == 0 { re...
go
func (reader PluginConfigReaderWithError) GetModulatorArray(key string, logger logrus.FieldLogger, defaultValue ModulatorArray) (ModulatorArray, error) { modulators := []Modulator{} modPlugins, err := reader.GetPluginArray(key, []Plugin{}) if err != nil { return modulators, err } if len(modPlugins) == 0 { re...
[ "func", "(", "reader", "PluginConfigReaderWithError", ")", "GetModulatorArray", "(", "key", "string", ",", "logger", "logrus", ".", "FieldLogger", ",", "defaultValue", "ModulatorArray", ")", "(", "ModulatorArray", ",", "error", ")", "{", "modulators", ":=", "[", ...
// GetModulatorArray returns an array of modulator plugins.
[ "GetModulatorArray", "returns", "an", "array", "of", "modulator", "plugins", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/pluginconfigreaderwitherror.go#L277-L311
20,521
trivago/gollum
core/pluginconfigreaderwitherror.go
GetStringArray
func (reader PluginConfigReaderWithError) GetStringArray(key string, defaultValue []string) ([]string, error) { key = reader.config.registerKey(key) if reader.HasValue(key) { return reader.config.Settings.StringArray(key) } return defaultValue, nil }
go
func (reader PluginConfigReaderWithError) GetStringArray(key string, defaultValue []string) ([]string, error) { key = reader.config.registerKey(key) if reader.HasValue(key) { return reader.config.Settings.StringArray(key) } return defaultValue, nil }
[ "func", "(", "reader", "PluginConfigReaderWithError", ")", "GetStringArray", "(", "key", "string", ",", "defaultValue", "[", "]", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "key", "=", "reader", ".", "config", ".", "registerKey", "(", ...
// GetStringArray tries to read a string array from a // PluginConfig. If that value is not found defaultValue is returned.
[ "GetStringArray", "tries", "to", "read", "a", "string", "array", "from", "a", "PluginConfig", ".", "If", "that", "value", "is", "not", "found", "defaultValue", "is", "returned", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/pluginconfigreaderwitherror.go#L370-L376
20,522
trivago/gollum
core/pluginconfigreaderwitherror.go
GetStringMap
func (reader PluginConfigReaderWithError) GetStringMap(key string, defaultValue map[string]string) (map[string]string, error) { key = reader.config.registerKey(key) if reader.HasValue(key) { return reader.config.Settings.StringMap(key) } return defaultValue, nil }
go
func (reader PluginConfigReaderWithError) GetStringMap(key string, defaultValue map[string]string) (map[string]string, error) { key = reader.config.registerKey(key) if reader.HasValue(key) { return reader.config.Settings.StringMap(key) } return defaultValue, nil }
[ "func", "(", "reader", "PluginConfigReaderWithError", ")", "GetStringMap", "(", "key", "string", ",", "defaultValue", "map", "[", "string", "]", "string", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "key", "=", "reader", ".", "...
// GetStringMap tries to read a string to string map from a // PluginConfig. If the key is not found defaultValue is returned.
[ "GetStringMap", "tries", "to", "read", "a", "string", "to", "string", "map", "from", "a", "PluginConfig", ".", "If", "the", "key", "is", "not", "found", "defaultValue", "is", "returned", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/pluginconfigreaderwitherror.go#L380-L386
20,523
trivago/gollum
core/pluginconfigreaderwitherror.go
GetStreamArray
func (reader PluginConfigReaderWithError) GetStreamArray(key string, defaultValue []MessageStreamID) ([]MessageStreamID, error) { key = reader.config.registerKey(key) if reader.HasValue(key) { values, err := reader.GetStringArray(key, []string{}) if err != nil { return nil, err } streamArray := []MessageSt...
go
func (reader PluginConfigReaderWithError) GetStreamArray(key string, defaultValue []MessageStreamID) ([]MessageStreamID, error) { key = reader.config.registerKey(key) if reader.HasValue(key) { values, err := reader.GetStringArray(key, []string{}) if err != nil { return nil, err } streamArray := []MessageSt...
[ "func", "(", "reader", "PluginConfigReaderWithError", ")", "GetStreamArray", "(", "key", "string", ",", "defaultValue", "[", "]", "MessageStreamID", ")", "(", "[", "]", "MessageStreamID", ",", "error", ")", "{", "key", "=", "reader", ".", "config", ".", "reg...
// GetStreamArray tries to read a string array from a pluginconfig // and translates all values to streamIds. If the key is not found defaultValue // is returned.
[ "GetStreamArray", "tries", "to", "read", "a", "string", "array", "from", "a", "pluginconfig", "and", "translates", "all", "values", "to", "streamIds", ".", "If", "the", "key", "is", "not", "found", "defaultValue", "is", "returned", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/pluginconfigreaderwitherror.go#L391-L406
20,524
trivago/gollum
core/pluginconfigreaderwitherror.go
GetStreamRoutes
func (reader PluginConfigReaderWithError) GetStreamRoutes(key string, defaultValue map[MessageStreamID][]MessageStreamID) (map[MessageStreamID][]MessageStreamID, error) { key = reader.config.registerKey(key) if !reader.HasValue(key) { return defaultValue, nil } streamRoute := make(map[MessageStreamID][]MessageSt...
go
func (reader PluginConfigReaderWithError) GetStreamRoutes(key string, defaultValue map[MessageStreamID][]MessageStreamID) (map[MessageStreamID][]MessageStreamID, error) { key = reader.config.registerKey(key) if !reader.HasValue(key) { return defaultValue, nil } streamRoute := make(map[MessageStreamID][]MessageSt...
[ "func", "(", "reader", "PluginConfigReaderWithError", ")", "GetStreamRoutes", "(", "key", "string", ",", "defaultValue", "map", "[", "MessageStreamID", "]", "[", "]", "MessageStreamID", ")", "(", "map", "[", "MessageStreamID", "]", "[", "]", "MessageStreamID", "...
// GetStreamRoutes tries to read a stream to stream map from a // plugin config. If no routes are defined an empty map is returned
[ "GetStreamRoutes", "tries", "to", "read", "a", "stream", "to", "stream", "map", "from", "a", "plugin", "config", ".", "If", "no", "routes", "are", "defined", "an", "empty", "map", "is", "returned" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/pluginconfigreaderwitherror.go#L434-L457
20,525
trivago/gollum
consumer/kafka.go
startAllConsumers
func (cons *Kafka) startAllConsumers() error { var err error if cons.group != "" { cons.groupClient, err = cluster.NewClient(cons.servers, cons.groupConfig) if err != nil { return err } go cons.readFromGroup() return nil // ### return, group processing ### } cons.client, err = kafka.NewClient(cons.s...
go
func (cons *Kafka) startAllConsumers() error { var err error if cons.group != "" { cons.groupClient, err = cluster.NewClient(cons.servers, cons.groupConfig) if err != nil { return err } go cons.readFromGroup() return nil // ### return, group processing ### } cons.client, err = kafka.NewClient(cons.s...
[ "func", "(", "cons", "*", "Kafka", ")", "startAllConsumers", "(", ")", "error", "{", "var", "err", "error", "\n\n", "if", "cons", ".", "group", "!=", "\"", "\"", "{", "cons", ".", "groupClient", ",", "err", "=", "cluster", ".", "NewClient", "(", "con...
// Start one consumer per partition as a go routine
[ "Start", "one", "consumer", "per", "partition", "as", "a", "go", "routine" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/consumer/kafka.go#L564-L590
20,526
trivago/gollum
consumer/kafka.go
dumpIndex
func (cons *Kafka) dumpIndex() { if cons.offsetFile != "" { encodedOffsets := make(map[string]int64) for k := range cons.offsets { encodedOffsets[strconv.Itoa(int(k))] = atomic.LoadInt64(cons.offsets[k]) } data, err := json.Marshal(encodedOffsets) if err != nil { cons.Logger.WithError(err).Error("Kafk...
go
func (cons *Kafka) dumpIndex() { if cons.offsetFile != "" { encodedOffsets := make(map[string]int64) for k := range cons.offsets { encodedOffsets[strconv.Itoa(int(k))] = atomic.LoadInt64(cons.offsets[k]) } data, err := json.Marshal(encodedOffsets) if err != nil { cons.Logger.WithError(err).Error("Kafk...
[ "func", "(", "cons", "*", "Kafka", ")", "dumpIndex", "(", ")", "{", "if", "cons", ".", "offsetFile", "!=", "\"", "\"", "{", "encodedOffsets", ":=", "make", "(", "map", "[", "string", "]", "int64", ")", "\n", "for", "k", ":=", "range", "cons", ".", ...
// Write index file to disc
[ "Write", "index", "file", "to", "disc" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/consumer/kafka.go#L593-L616
20,527
trivago/gollum
consumer/kafka.go
Consume
func (cons *Kafka) Consume(workers *sync.WaitGroup) { cons.SetWorkerWaitGroup(workers) if err := cons.startAllConsumers(); err != nil { cons.Logger.WithError(err).Error("Kafka client error") time.AfterFunc(cons.config.Net.DialTimeout, func() { cons.Consume(workers) }) return } defer func() { cons.client.C...
go
func (cons *Kafka) Consume(workers *sync.WaitGroup) { cons.SetWorkerWaitGroup(workers) if err := cons.startAllConsumers(); err != nil { cons.Logger.WithError(err).Error("Kafka client error") time.AfterFunc(cons.config.Net.DialTimeout, func() { cons.Consume(workers) }) return } defer func() { cons.client.C...
[ "func", "(", "cons", "*", "Kafka", ")", "Consume", "(", "workers", "*", "sync", ".", "WaitGroup", ")", "{", "cons", ".", "SetWorkerWaitGroup", "(", "workers", ")", "\n\n", "if", "err", ":=", "cons", ".", "startAllConsumers", "(", ")", ";", "err", "!=",...
// Consume starts a kafka consumer per partition for this topic
[ "Consume", "starts", "a", "kafka", "consumer", "per", "partition", "for", "this", "topic" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/consumer/kafka.go#L619-L634
20,528
trivago/gollum
format/jsontoinflux10.go
toUnixTime
func (format *JSONToInflux10) toUnixTime(timeString string) (int64, error) { if format.timeFormat == "unix" { return strconv.ParseInt(timeString, 10, 64) } t, err := time.Parse(format.timeFormat, timeString) if err != nil { return 0, err } return t.Unix(), nil }
go
func (format *JSONToInflux10) toUnixTime(timeString string) (int64, error) { if format.timeFormat == "unix" { return strconv.ParseInt(timeString, 10, 64) } t, err := time.Parse(format.timeFormat, timeString) if err != nil { return 0, err } return t.Unix(), nil }
[ "func", "(", "format", "*", "JSONToInflux10", ")", "toUnixTime", "(", "timeString", "string", ")", "(", "int64", ",", "error", ")", "{", "if", "format", ".", "timeFormat", "==", "\"", "\"", "{", "return", "strconv", ".", "ParseInt", "(", "timeString", ",...
// Return the time field as a unix timestamp
[ "Return", "the", "time", "field", "as", "a", "unix", "timestamp" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/format/jsontoinflux10.go#L132-L141
20,529
trivago/gollum
format/jsontoinflux10.go
ApplyFormatter
func (format *JSONToInflux10) ApplyFormatter(msg *core.Message) error { content := format.GetAppliedContent(msg) values := make(tcontainer.MarshalMap) err := json.Unmarshal(content, &values) if err != nil { format.Logger.Warningf("JSON parser error: %s, Message: %s", err, content) return err } var timestam...
go
func (format *JSONToInflux10) ApplyFormatter(msg *core.Message) error { content := format.GetAppliedContent(msg) values := make(tcontainer.MarshalMap) err := json.Unmarshal(content, &values) if err != nil { format.Logger.Warningf("JSON parser error: %s, Message: %s", err, content) return err } var timestam...
[ "func", "(", "format", "*", "JSONToInflux10", ")", "ApplyFormatter", "(", "msg", "*", "core", ".", "Message", ")", "error", "{", "content", ":=", "format", ".", "GetAppliedContent", "(", "msg", ")", "\n\n", "values", ":=", "make", "(", "tcontainer", ".", ...
// ApplyFormatter updates the message payload
[ "ApplyFormatter", "updates", "the", "message", "payload" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/format/jsontoinflux10.go#L144-L207
20,530
trivago/gollum
core/modulator.go
Modulate
func (modulators ModulatorArray) Modulate(msg *Message) ModulateResult { action := ModulateResultContinue for _, modulator := range modulators { switch modRes := modulator.Modulate(msg); modRes { case ModulateResultDiscard, ModulateResultFallback: return modRes // ### return, break modulator calls ### } } ...
go
func (modulators ModulatorArray) Modulate(msg *Message) ModulateResult { action := ModulateResultContinue for _, modulator := range modulators { switch modRes := modulator.Modulate(msg); modRes { case ModulateResultDiscard, ModulateResultFallback: return modRes // ### return, break modulator calls ### } } ...
[ "func", "(", "modulators", "ModulatorArray", ")", "Modulate", "(", "msg", "*", "Message", ")", "ModulateResult", "{", "action", ":=", "ModulateResultContinue", "\n", "for", "_", ",", "modulator", ":=", "range", "modulators", "{", "switch", "modRes", ":=", "mod...
// Modulate calls Modulate on every Modulator in the array and react according // to the definition of each ModulateResult state.
[ "Modulate", "calls", "Modulate", "on", "every", "Modulator", "in", "the", "array", "and", "react", "according", "to", "the", "definition", "of", "each", "ModulateResult", "state", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/modulator.go#L61-L70
20,531
trivago/gollum
producer/httprequest.go
sendReq
func (prod *HTTPRequest) sendReq(msg *core.Message) { var ( req *http.Request err error ) requestData := bytes.NewBuffer(msg.GetPayload()) if prod.rawPackets { // Assume the message already contains an HTTP request in wire format. // Create a Request object, override host, port and scheme, and send it out...
go
func (prod *HTTPRequest) sendReq(msg *core.Message) { var ( req *http.Request err error ) requestData := bytes.NewBuffer(msg.GetPayload()) if prod.rawPackets { // Assume the message already contains an HTTP request in wire format. // Create a Request object, override host, port and scheme, and send it out...
[ "func", "(", "prod", "*", "HTTPRequest", ")", "sendReq", "(", "msg", "*", "core", ".", "Message", ")", "{", "var", "(", "req", "*", "http", ".", "Request", "\n", "err", "error", "\n", ")", "\n\n", "requestData", ":=", "bytes", ".", "NewBuffer", "(", ...
// The onMessage callback
[ "The", "onMessage", "callback" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/producer/httprequest.go#L157-L204
20,532
trivago/gollum
core/version.go
GetVersionNumber
func GetVersionNumber() (int64, int) { ver := strings.Replace(GetVersionString(), "-", ".", -1) parts := strings.Split(ver, ".") multiplier := int64(100 * 100) // major, minor, patch version := int64(0) buildNum := int(0) for i, subVerString := range parts { if i == 3 { buildNum, _ = strconv.Atoi(subVerStrin...
go
func GetVersionNumber() (int64, int) { ver := strings.Replace(GetVersionString(), "-", ".", -1) parts := strings.Split(ver, ".") multiplier := int64(100 * 100) // major, minor, patch version := int64(0) buildNum := int(0) for i, subVerString := range parts { if i == 3 { buildNum, _ = strconv.Atoi(subVerStrin...
[ "func", "GetVersionNumber", "(", ")", "(", "int64", ",", "int", ")", "{", "ver", ":=", "strings", ".", "Replace", "(", "GetVersionString", "(", ")", ",", "\"", "\"", ",", "\"", "\"", ",", "-", "1", ")", "\n", "parts", ":=", "strings", ".", "Split",...
// GetVersionNumber returns the version as integer. Each part of the semver // string is assigned to decimals, so v1.2.3 will be 10203. // The build number refers to the first postfix of the semver string, i.e. // v1.2.3-4-badf00d will return 10203 and 4
[ "GetVersionNumber", "returns", "the", "version", "as", "integer", ".", "Each", "part", "of", "the", "semver", "string", "is", "assigned", "to", "decimals", "so", "v1", ".", "2", ".", "3", "will", "be", "10203", ".", "The", "build", "number", "refers", "t...
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/version.go#L36-L56
20,533
trivago/gollum
core/filtermodulator.go
Modulate
func (filterModulator *FilterModulator) Modulate(msg *Message) ModulateResult { result, err := filterModulator.ApplyFilter(msg) if err != nil { logrus.Warning("FilterModulator with error:", err) } if result == FilterResultMessageAccept { return ModulateResultContinue } newStreamID := result.GetStreamID() i...
go
func (filterModulator *FilterModulator) Modulate(msg *Message) ModulateResult { result, err := filterModulator.ApplyFilter(msg) if err != nil { logrus.Warning("FilterModulator with error:", err) } if result == FilterResultMessageAccept { return ModulateResultContinue } newStreamID := result.GetStreamID() i...
[ "func", "(", "filterModulator", "*", "FilterModulator", ")", "Modulate", "(", "msg", "*", "Message", ")", "ModulateResult", "{", "result", ",", "err", ":=", "filterModulator", ".", "ApplyFilter", "(", "msg", ")", "\n", "if", "err", "!=", "nil", "{", "logru...
// Modulate implementation for Filters
[ "Modulate", "implementation", "for", "Filters" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/filtermodulator.go#L34-L51
20,534
trivago/gollum
docs/generator/plugindocument.go
next
func (iter *sliceIterator) next() (string, string, int) { if iter.position > len(iter.slice)-1 { return "", "", -1 } position := iter.position iter.position++ return iter.slice[position], strings.Trim(iter.slice[position], " \t"), position }
go
func (iter *sliceIterator) next() (string, string, int) { if iter.position > len(iter.slice)-1 { return "", "", -1 } position := iter.position iter.position++ return iter.slice[position], strings.Trim(iter.slice[position], " \t"), position }
[ "func", "(", "iter", "*", "sliceIterator", ")", "next", "(", ")", "(", "string", ",", "string", ",", "int", ")", "{", "if", "iter", ".", "position", ">", "len", "(", "iter", ".", "slice", ")", "-", "1", "{", "return", "\"", "\"", ",", "\"", "\"...
// next returns the current string and advances the iterator
[ "next", "returns", "the", "current", "string", "and", "advances", "the", "iterator" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/docs/generator/plugindocument.go#L47-L54
20,535
trivago/gollum
docs/generator/plugindocument.go
NewPluginDocument
func NewPluginDocument(plugin GollumPlugin) PluginDocument { pluginDocument := PluginDocument{ PackageName: plugin.Pkg, PluginName: plugin.Name, } // The "Enable" parameter is implemented in the coordinator / plugonconfig // and not inherited from simple*** types. Documentation for this option is // hardcode...
go
func NewPluginDocument(plugin GollumPlugin) PluginDocument { pluginDocument := PluginDocument{ PackageName: plugin.Pkg, PluginName: plugin.Name, } // The "Enable" parameter is implemented in the coordinator / plugonconfig // and not inherited from simple*** types. Documentation for this option is // hardcode...
[ "func", "NewPluginDocument", "(", "plugin", "GollumPlugin", ")", "PluginDocument", "{", "pluginDocument", ":=", "PluginDocument", "{", "PackageName", ":", "plugin", ".", "Pkg", ",", "PluginName", ":", "plugin", ".", "Name", ",", "}", "\n\n", "// The \"Enable\" par...
// NewPluginDocument creates a PluginDocument from the GollumPlugin
[ "NewPluginDocument", "creates", "a", "PluginDocument", "from", "the", "GollumPlugin" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/docs/generator/plugindocument.go#L68-L123
20,536
trivago/gollum
docs/generator/plugindocument.go
DumpString
func (doc *PluginDocument) DumpString() string { str := "" str += "==================== START DUMP ============================\n" str += "PackageName: [" + doc.PackageName + "]\n" str += "PluginName: [" + doc.PluginName + "]\n" str += "BlockHeading: [" + doc.BlockHeading + "]\n" str += "Description: [" + doc.De...
go
func (doc *PluginDocument) DumpString() string { str := "" str += "==================== START DUMP ============================\n" str += "PackageName: [" + doc.PackageName + "]\n" str += "PluginName: [" + doc.PluginName + "]\n" str += "BlockHeading: [" + doc.BlockHeading + "]\n" str += "Description: [" + doc.De...
[ "func", "(", "doc", "*", "PluginDocument", ")", "DumpString", "(", ")", "string", "{", "str", ":=", "\"", "\"", "\n", "str", "+=", "\"", "\\n", "\"", "\n", "str", "+=", "\"", "\"", "+", "doc", ".", "PackageName", "+", "\"", "\\n", "\"", "\n", "st...
// DumpString returns a human-readable string dumpString of this object
[ "DumpString", "returns", "a", "human", "-", "readable", "string", "dumpString", "of", "this", "object" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/docs/generator/plugindocument.go#L126-L151
20,537
trivago/gollum
docs/generator/plugindocument.go
InheritMetadata
func (doc *PluginDocument) InheritMetadata(parentDoc PluginDocument) { if doc.InheritedMetadata == nil { doc.InheritedMetadata = make(map[string]DefinitionList) } // Inherit the parent's direct metadata fields, but exclude locally defined params doc.InheritedMetadata[parentDoc.PackageName+"."+parentDoc.PluginNam...
go
func (doc *PluginDocument) InheritMetadata(parentDoc PluginDocument) { if doc.InheritedMetadata == nil { doc.InheritedMetadata = make(map[string]DefinitionList) } // Inherit the parent's direct metadata fields, but exclude locally defined params doc.InheritedMetadata[parentDoc.PackageName+"."+parentDoc.PluginNam...
[ "func", "(", "doc", "*", "PluginDocument", ")", "InheritMetadata", "(", "parentDoc", "PluginDocument", ")", "{", "if", "doc", ".", "InheritedMetadata", "==", "nil", "{", "doc", ".", "InheritedMetadata", "=", "make", "(", "map", "[", "string", "]", "Definitio...
// InheritMetadata imports the .Metadata property of `document` into this document's // inherited metadata list
[ "InheritMetadata", "imports", "the", ".", "Metadata", "property", "of", "document", "into", "this", "document", "s", "inherited", "metadata", "list" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/docs/generator/plugindocument.go#L242-L255
20,538
trivago/gollum
docs/generator/plugindocument.go
InheritParameters
func (doc *PluginDocument) InheritParameters(parentDoc PluginDocument) { if doc.InheritedParameters == nil { doc.InheritedParameters = make(map[string]DefinitionList) } // Inherit the parent's direct parameters, but exclude locally defined params doc.InheritedParameters[parentDoc.PackageName+"."+parentDoc.Plugin...
go
func (doc *PluginDocument) InheritParameters(parentDoc PluginDocument) { if doc.InheritedParameters == nil { doc.InheritedParameters = make(map[string]DefinitionList) } // Inherit the parent's direct parameters, but exclude locally defined params doc.InheritedParameters[parentDoc.PackageName+"."+parentDoc.Plugin...
[ "func", "(", "doc", "*", "PluginDocument", ")", "InheritParameters", "(", "parentDoc", "PluginDocument", ")", "{", "if", "doc", ".", "InheritedParameters", "==", "nil", "{", "doc", ".", "InheritedParameters", "=", "make", "(", "map", "[", "string", "]", "Def...
// InheritParameters imports the .Parameters property of `document` into this document's // inherited param list
[ "InheritParameters", "imports", "the", ".", "Parameters", "property", "of", "document", "into", "this", "document", "s", "inherited", "param", "list" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/docs/generator/plugindocument.go#L259-L272
20,539
trivago/gollum
docs/generator/plugindocument.go
GetRST
func (doc PluginDocument) GetRST() string { result := "" // Print top comment result += ".. Autogenerated by Gollum RST generator (docs/generator/*.go)\n\n" // Print heading result += doc.PluginName + "\n" result += strings.Repeat("=", len(doc.PluginName)) + "\n" // Print description result += "\n" result +...
go
func (doc PluginDocument) GetRST() string { result := "" // Print top comment result += ".. Autogenerated by Gollum RST generator (docs/generator/*.go)\n\n" // Print heading result += doc.PluginName + "\n" result += strings.Repeat("=", len(doc.PluginName)) + "\n" // Print description result += "\n" result +...
[ "func", "(", "doc", "PluginDocument", ")", "GetRST", "(", ")", "string", "{", "result", ":=", "\"", "\"", "\n\n", "// Print top comment", "result", "+=", "\"", "\\n", "\\n", "\"", "\n\n", "// Print heading", "result", "+=", "doc", ".", "PluginName", "+", "...
// GetRST returns an RST representation of this PluginDocument.
[ "GetRST", "returns", "an", "RST", "representation", "of", "this", "PluginDocument", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/docs/generator/plugindocument.go#L309-L387
20,540
trivago/gollum
core/metrics.go
GetStreamMetric
func GetStreamMetric(streamID MessageStreamID) *StreamMetric { metricsStreamRegistryGuard.RLock() if stream, ok := metricsStreamRegistry[streamID]; ok { metricsStreamRegistryGuard.RUnlock() return stream } metricsStreamRegistryGuard.RUnlock() metricsStreamRegistryGuard.Lock() defer metricsStreamRegistryGuard...
go
func GetStreamMetric(streamID MessageStreamID) *StreamMetric { metricsStreamRegistryGuard.RLock() if stream, ok := metricsStreamRegistry[streamID]; ok { metricsStreamRegistryGuard.RUnlock() return stream } metricsStreamRegistryGuard.RUnlock() metricsStreamRegistryGuard.Lock() defer metricsStreamRegistryGuard...
[ "func", "GetStreamMetric", "(", "streamID", "MessageStreamID", ")", "*", "StreamMetric", "{", "metricsStreamRegistryGuard", ".", "RLock", "(", ")", "\n", "if", "stream", ",", "ok", ":=", "metricsStreamRegistry", "[", "streamID", "]", ";", "ok", "{", "metricsStre...
// GetStreamMetric returns the metrics handles for a given stream.
[ "GetStreamMetric", "returns", "the", "metrics", "handles", "for", "a", "given", "stream", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/metrics.go#L139-L161
20,541
trivago/gollum
core/router.go
Route
func Route(msg *Message, router Router) error { if router == nil { DiscardMessage(msg, "nil", fmt.Sprintf("Router for stream %s is nil", msg.GetStreamID().GetName())) return nil } action := router.Modulate(msg) streamName := msg.GetStreamID().GetName() switch action { case ModulateResultDiscard: MetricMes...
go
func Route(msg *Message, router Router) error { if router == nil { DiscardMessage(msg, "nil", fmt.Sprintf("Router for stream %s is nil", msg.GetStreamID().GetName())) return nil } action := router.Modulate(msg) streamName := msg.GetStreamID().GetName() switch action { case ModulateResultDiscard: MetricMes...
[ "func", "Route", "(", "msg", "*", "Message", ",", "router", "Router", ")", "error", "{", "if", "router", "==", "nil", "{", "DiscardMessage", "(", "msg", ",", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "msg", ".", "GetStreamID", "...
// Route tries to enqueue a message to the given stream. This function also // handles redirections enforced by formatters.
[ "Route", "tries", "to", "enqueue", "a", "message", "to", "the", "given", "stream", ".", "This", "function", "also", "handles", "redirections", "enforced", "by", "formatters", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/router.go#L50-L88
20,542
trivago/gollum
core/router.go
RouteOriginal
func RouteOriginal(msg *Message, router Router) error { return Route(msg.CloneOriginal(), router) }
go
func RouteOriginal(msg *Message, router Router) error { return Route(msg.CloneOriginal(), router) }
[ "func", "RouteOriginal", "(", "msg", "*", "Message", ",", "router", "Router", ")", "error", "{", "return", "Route", "(", "msg", ".", "CloneOriginal", "(", ")", ",", "router", ")", "\n", "}" ]
// RouteOriginal restores the original message and routes it by using a // a given router.
[ "RouteOriginal", "restores", "the", "original", "message", "and", "routes", "it", "by", "using", "a", "a", "given", "router", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/router.go#L92-L94
20,543
trivago/gollum
core/router.go
DiscardMessage
func DiscardMessage(msg *Message, pluginID string, comment string) { GetStreamMetric(msg.GetStreamID()).Discarded.Inc(1) MessageTrace(msg, pluginID, comment) }
go
func DiscardMessage(msg *Message, pluginID string, comment string) { GetStreamMetric(msg.GetStreamID()).Discarded.Inc(1) MessageTrace(msg, pluginID, comment) }
[ "func", "DiscardMessage", "(", "msg", "*", "Message", ",", "pluginID", "string", ",", "comment", "string", ")", "{", "GetStreamMetric", "(", "msg", ".", "GetStreamID", "(", ")", ")", ".", "Discarded", ".", "Inc", "(", "1", ")", "\n", "MessageTrace", "(",...
// DiscardMessage increases the discard statistic and discards the given // message.
[ "DiscardMessage", "increases", "the", "discard", "statistic", "and", "discards", "the", "given", "message", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/router.go#L98-L101
20,544
trivago/gollum
core/batchedproducer.go
appendMessage
func (prod *BatchedProducer) appendMessage(msg *Message) { prod.Batch.AppendOrFlush(msg, prod.flushBatch, prod.IsActiveOrStopping, prod.TryFallback) }
go
func (prod *BatchedProducer) appendMessage(msg *Message) { prod.Batch.AppendOrFlush(msg, prod.flushBatch, prod.IsActiveOrStopping, prod.TryFallback) }
[ "func", "(", "prod", "*", "BatchedProducer", ")", "appendMessage", "(", "msg", "*", "Message", ")", "{", "prod", ".", "Batch", ".", "AppendOrFlush", "(", "msg", ",", "prod", ".", "flushBatch", ",", "prod", ".", "IsActiveOrStopping", ",", "prod", ".", "Tr...
// appendMessage append a message to the batch at enqueuing
[ "appendMessage", "append", "a", "message", "to", "the", "batch", "at", "enqueuing" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/batchedproducer.go#L84-L86
20,545
trivago/gollum
core/batchedproducer.go
flushBatchOnTimeOut
func (prod *BatchedProducer) flushBatchOnTimeOut() { if prod.Batch.ReachedTimeThreshold(prod.batchTimeout) || prod.Batch.ReachedSizeThreshold(prod.batchFlushCount) { prod.flushBatch() } }
go
func (prod *BatchedProducer) flushBatchOnTimeOut() { if prod.Batch.ReachedTimeThreshold(prod.batchTimeout) || prod.Batch.ReachedSizeThreshold(prod.batchFlushCount) { prod.flushBatch() } }
[ "func", "(", "prod", "*", "BatchedProducer", ")", "flushBatchOnTimeOut", "(", ")", "{", "if", "prod", ".", "Batch", ".", "ReachedTimeThreshold", "(", "prod", ".", "batchTimeout", ")", "||", "prod", ".", "Batch", ".", "ReachedSizeThreshold", "(", "prod", ".",...
// flushBatchOnTimeOut is the used function pointer to flush the batch on timeout or reached max size
[ "flushBatchOnTimeOut", "is", "the", "used", "function", "pointer", "to", "flush", "the", "batch", "on", "timeout", "or", "reached", "max", "size" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/batchedproducer.go#L94-L98
20,546
trivago/gollum
core/batchedproducer.go
DefaultClose
func (prod *BatchedProducer) DefaultClose() { defer prod.WorkerDone() prod.Batch.Close(prod.onBatchFlush(), prod.GetShutdownTimeout()) }
go
func (prod *BatchedProducer) DefaultClose() { defer prod.WorkerDone() prod.Batch.Close(prod.onBatchFlush(), prod.GetShutdownTimeout()) }
[ "func", "(", "prod", "*", "BatchedProducer", ")", "DefaultClose", "(", ")", "{", "defer", "prod", ".", "WorkerDone", "(", ")", "\n", "prod", ".", "Batch", ".", "Close", "(", "prod", ".", "onBatchFlush", "(", ")", ",", "prod", ".", "GetShutdownTimeout", ...
// DefaultClose defines the default closing process
[ "DefaultClose", "defines", "the", "default", "closing", "process" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/batchedproducer.go#L109-L112
20,547
trivago/gollum
producer/null.go
Produce
func (prod *Null) Produce(threads *sync.WaitGroup) { prod.MessageControlLoop(func(*core.Message) {}) }
go
func (prod *Null) Produce(threads *sync.WaitGroup) { prod.MessageControlLoop(func(*core.Message) {}) }
[ "func", "(", "prod", "*", "Null", ")", "Produce", "(", "threads", "*", "sync", ".", "WaitGroup", ")", "{", "prod", ".", "MessageControlLoop", "(", "func", "(", "*", "core", ".", "Message", ")", "{", "}", ")", "\n", "}" ]
// Produce starts a control loop only
[ "Produce", "starts", "a", "control", "loop", "only" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/producer/null.go#L41-L43
20,548
trivago/gollum
producer/file.go
Produce
func (prod *File) Produce(workers *sync.WaitGroup) { prod.AddMainWorker(workers) prod.TickerMessageControlLoop(prod.writeMessage, prod.BatchConfig.BatchTimeout, prod.writeBatchOnTimeOut) }
go
func (prod *File) Produce(workers *sync.WaitGroup) { prod.AddMainWorker(workers) prod.TickerMessageControlLoop(prod.writeMessage, prod.BatchConfig.BatchTimeout, prod.writeBatchOnTimeOut) }
[ "func", "(", "prod", "*", "File", ")", "Produce", "(", "workers", "*", "sync", ".", "WaitGroup", ")", "{", "prod", ".", "AddMainWorker", "(", "workers", ")", "\n", "prod", ".", "TickerMessageControlLoop", "(", "prod", ".", "writeMessage", ",", "prod", "....
// Produce writes to a buffer that is dumped to a file.
[ "Produce", "writes", "to", "a", "buffer", "that", "is", "dumped", "to", "a", "file", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/producer/file.go#L117-L120
20,549
trivago/gollum
producer/kafkaMurmur2HashPartitioner.go
NewMurmur2HashPartitioner
func NewMurmur2HashPartitioner(topic string) kafka.Partitioner { p := new(Murmur2HashPartitioner) p.random = kafka.NewRandomPartitioner(topic) return p }
go
func NewMurmur2HashPartitioner(topic string) kafka.Partitioner { p := new(Murmur2HashPartitioner) p.random = kafka.NewRandomPartitioner(topic) return p }
[ "func", "NewMurmur2HashPartitioner", "(", "topic", "string", ")", "kafka", ".", "Partitioner", "{", "p", ":=", "new", "(", "Murmur2HashPartitioner", ")", "\n", "p", ".", "random", "=", "kafka", ".", "NewRandomPartitioner", "(", "topic", ")", "\n", "return", ...
// NewMurmur2HashPartitioner creates a new sarama partitioner based on the // murmur2 hash algorithm.
[ "NewMurmur2HashPartitioner", "creates", "a", "new", "sarama", "partitioner", "based", "on", "the", "murmur2", "hash", "algorithm", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/producer/kafkaMurmur2HashPartitioner.go#L17-L21
20,550
trivago/gollum
producer/kafkaMurmur2HashPartitioner.go
Partition
func (p *Murmur2HashPartitioner) Partition(message *kafka.ProducerMessage, numPartitions int32) (int32, error) { if message.Key == nil { return p.random.Partition(message, numPartitions) } key, err := message.Key.Encode() if err != nil { return -1, err } // murmur2 implementation based on https://github.com/a...
go
func (p *Murmur2HashPartitioner) Partition(message *kafka.ProducerMessage, numPartitions int32) (int32, error) { if message.Key == nil { return p.random.Partition(message, numPartitions) } key, err := message.Key.Encode() if err != nil { return -1, err } // murmur2 implementation based on https://github.com/a...
[ "func", "(", "p", "*", "Murmur2HashPartitioner", ")", "Partition", "(", "message", "*", "kafka", ".", "ProducerMessage", ",", "numPartitions", "int32", ")", "(", "int32", ",", "error", ")", "{", "if", "message", ".", "Key", "==", "nil", "{", "return", "p...
// Partition chooses a partition based on the murmur2 hash of the key. // If no key is given a random parition is chosen.
[ "Partition", "chooses", "a", "partition", "based", "on", "the", "murmur2", "hash", "of", "the", "key", ".", "If", "no", "key", "is", "given", "a", "random", "parition", "is", "chosen", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/producer/kafkaMurmur2HashPartitioner.go#L25-L90
20,551
trivago/gollum
contrib/native/pcap/pcaphttp.go
Consume
func (cons *PcapHTTPConsumer) Consume(workers *sync.WaitGroup) { cons.initPcap() cons.AddMainWorker(workers) go cons.readPackets() cons.ControlLoop() }
go
func (cons *PcapHTTPConsumer) Consume(workers *sync.WaitGroup) { cons.initPcap() cons.AddMainWorker(workers) go cons.readPackets() cons.ControlLoop() }
[ "func", "(", "cons", "*", "PcapHTTPConsumer", ")", "Consume", "(", "workers", "*", "sync", ".", "WaitGroup", ")", "{", "cons", ".", "initPcap", "(", ")", "\n", "cons", ".", "AddMainWorker", "(", "workers", ")", "\n\n", "go", "cons", ".", "readPackets", ...
// Consume enables libpcap monitoring as configured.
[ "Consume", "enables", "libpcap", "monitoring", "as", "configured", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/contrib/native/pcap/pcaphttp.go#L237-L243
20,552
trivago/gollum
core/components/batchedWriterAssembly.go
Configure
func (c *BatchedWriterConfig) Configure(conf core.PluginConfigReader) { c.BatchFlushCount = tmath.MinI(c.BatchFlushCount, c.BatchMaxCount) }
go
func (c *BatchedWriterConfig) Configure(conf core.PluginConfigReader) { c.BatchFlushCount = tmath.MinI(c.BatchFlushCount, c.BatchMaxCount) }
[ "func", "(", "c", "*", "BatchedWriterConfig", ")", "Configure", "(", "conf", "core", ".", "PluginConfigReader", ")", "{", "c", ".", "BatchFlushCount", "=", "tmath", ".", "MinI", "(", "c", ".", "BatchFlushCount", ",", "c", ".", "BatchMaxCount", ")", "\n", ...
// Configure interface implementation
[ "Configure", "interface", "implementation" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/components/batchedWriterAssembly.go#L57-L59
20,553
trivago/gollum
core/components/batchedWriterAssembly.go
NewBatchedWriterAssembly
func NewBatchedWriterAssembly(config BatchedWriterConfig, modulator core.Modulator, tryFallback func(*core.Message), logger logrus.FieldLogger) *BatchedWriterAssembly { return &BatchedWriterAssembly{ Batch: core.NewMessageBatch(config.BatchMaxCount), assembly: core.NewWriterAssembly(nil, tryFallback, modulator)...
go
func NewBatchedWriterAssembly(config BatchedWriterConfig, modulator core.Modulator, tryFallback func(*core.Message), logger logrus.FieldLogger) *BatchedWriterAssembly { return &BatchedWriterAssembly{ Batch: core.NewMessageBatch(config.BatchMaxCount), assembly: core.NewWriterAssembly(nil, tryFallback, modulator)...
[ "func", "NewBatchedWriterAssembly", "(", "config", "BatchedWriterConfig", ",", "modulator", "core", ".", "Modulator", ",", "tryFallback", "func", "(", "*", "core", ".", "Message", ")", ",", "logger", "logrus", ".", "FieldLogger", ")", "*", "BatchedWriterAssembly",...
// NewBatchedWriterAssembly returns a new BatchedWriterAssembly instance
[ "NewBatchedWriterAssembly", "returns", "a", "new", "BatchedWriterAssembly", "instance" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/components/batchedWriterAssembly.go#L80-L87
20,554
trivago/gollum
core/components/batchedWriterAssembly.go
SetWriter
func (bwa *BatchedWriterAssembly) SetWriter(writer BatchedWriter) { bwa.writer = writer bwa.Created = time.Now() }
go
func (bwa *BatchedWriterAssembly) SetWriter(writer BatchedWriter) { bwa.writer = writer bwa.Created = time.Now() }
[ "func", "(", "bwa", "*", "BatchedWriterAssembly", ")", "SetWriter", "(", "writer", "BatchedWriter", ")", "{", "bwa", ".", "writer", "=", "writer", "\n", "bwa", ".", "Created", "=", "time", ".", "Now", "(", ")", "\n", "}" ]
// SetWriter set a BatchedWriter interface implementation
[ "SetWriter", "set", "a", "BatchedWriter", "interface", "implementation" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/components/batchedWriterAssembly.go#L95-L98
20,555
trivago/gollum
core/components/batchedWriterAssembly.go
GetWriterAndUnset
func (bwa *BatchedWriterAssembly) GetWriterAndUnset() BatchedWriter { writer := bwa.GetWriter() bwa.UnsetWriter() return writer }
go
func (bwa *BatchedWriterAssembly) GetWriterAndUnset() BatchedWriter { writer := bwa.GetWriter() bwa.UnsetWriter() return writer }
[ "func", "(", "bwa", "*", "BatchedWriterAssembly", ")", "GetWriterAndUnset", "(", ")", "BatchedWriter", "{", "writer", ":=", "bwa", ".", "GetWriter", "(", ")", "\n", "bwa", ".", "UnsetWriter", "(", ")", "\n", "return", "writer", "\n", "}" ]
// GetWriterAndUnset returns the current writer and unset it
[ "GetWriterAndUnset", "returns", "the", "current", "writer", "and", "unset", "it" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/components/batchedWriterAssembly.go#L106-L110
20,556
trivago/gollum
core/components/batchedWriterAssembly.go
Flush
func (bwa *BatchedWriterAssembly) Flush() { if bwa.writer != nil { bwa.assembly.SetWriter(bwa.writer) bwa.Batch.Flush(bwa.assembly.Write) } else { bwa.Batch.Flush(bwa.assembly.Flush) } }
go
func (bwa *BatchedWriterAssembly) Flush() { if bwa.writer != nil { bwa.assembly.SetWriter(bwa.writer) bwa.Batch.Flush(bwa.assembly.Write) } else { bwa.Batch.Flush(bwa.assembly.Flush) } }
[ "func", "(", "bwa", "*", "BatchedWriterAssembly", ")", "Flush", "(", ")", "{", "if", "bwa", ".", "writer", "!=", "nil", "{", "bwa", ".", "assembly", ".", "SetWriter", "(", "bwa", ".", "writer", ")", "\n", "bwa", ".", "Batch", ".", "Flush", "(", "bw...
// Flush flush the batch
[ "Flush", "flush", "the", "batch" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/components/batchedWriterAssembly.go#L118-L125
20,557
trivago/gollum
core/components/batchedWriterAssembly.go
Close
func (bwa *BatchedWriterAssembly) Close() { if bwa.writer != nil { bwa.assembly.SetWriter(bwa.writer) bwa.Batch.Close(bwa.assembly.Write, bwa.config.BatchFlushTimeout) } else { bwa.Batch.Close(bwa.assembly.Flush, bwa.config.BatchFlushTimeout) } bwa.writer.Close() }
go
func (bwa *BatchedWriterAssembly) Close() { if bwa.writer != nil { bwa.assembly.SetWriter(bwa.writer) bwa.Batch.Close(bwa.assembly.Write, bwa.config.BatchFlushTimeout) } else { bwa.Batch.Close(bwa.assembly.Flush, bwa.config.BatchFlushTimeout) } bwa.writer.Close() }
[ "func", "(", "bwa", "*", "BatchedWriterAssembly", ")", "Close", "(", ")", "{", "if", "bwa", ".", "writer", "!=", "nil", "{", "bwa", ".", "assembly", ".", "SetWriter", "(", "bwa", ".", "writer", ")", "\n", "bwa", ".", "Batch", ".", "Close", "(", "bw...
// Close closes batch and writer
[ "Close", "closes", "batch", "and", "writer" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/components/batchedWriterAssembly.go#L128-L136
20,558
trivago/gollum
core/components/batchedWriterAssembly.go
FlushOnTimeOut
func (bwa *BatchedWriterAssembly) FlushOnTimeOut() { if bwa.Batch.ReachedTimeThreshold(bwa.config.BatchTimeout) || bwa.Batch.ReachedSizeThreshold(bwa.config.BatchFlushCount) { bwa.Flush() } }
go
func (bwa *BatchedWriterAssembly) FlushOnTimeOut() { if bwa.Batch.ReachedTimeThreshold(bwa.config.BatchTimeout) || bwa.Batch.ReachedSizeThreshold(bwa.config.BatchFlushCount) { bwa.Flush() } }
[ "func", "(", "bwa", "*", "BatchedWriterAssembly", ")", "FlushOnTimeOut", "(", ")", "{", "if", "bwa", ".", "Batch", ".", "ReachedTimeThreshold", "(", "bwa", ".", "config", ".", "BatchTimeout", ")", "||", "bwa", ".", "Batch", ".", "ReachedSizeThreshold", "(", ...
// FlushOnTimeOut checks if timeout or slush count reached and flush in this case
[ "FlushOnTimeOut", "checks", "if", "timeout", "or", "slush", "count", "reached", "and", "flush", "in", "this", "case" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/components/batchedWriterAssembly.go#L139-L143
20,559
trivago/gollum
core/components/batchedWriterAssembly.go
NeedsRotate
func (bwa *BatchedWriterAssembly) NeedsRotate(rotate RotateConfig, forceRotate bool) (bool, error) { // File does not exist? if !bwa.HasWriter() { bwa.logger.Debug("Rotate true: ", "no writer") return true, nil } // File can be accessed? if !bwa.GetWriter().IsAccessible() { bwa.logger.Debug("Rotate false: "...
go
func (bwa *BatchedWriterAssembly) NeedsRotate(rotate RotateConfig, forceRotate bool) (bool, error) { // File does not exist? if !bwa.HasWriter() { bwa.logger.Debug("Rotate true: ", "no writer") return true, nil } // File can be accessed? if !bwa.GetWriter().IsAccessible() { bwa.logger.Debug("Rotate false: "...
[ "func", "(", "bwa", "*", "BatchedWriterAssembly", ")", "NeedsRotate", "(", "rotate", "RotateConfig", ",", "forceRotate", "bool", ")", "(", "bool", ",", "error", ")", "{", "// File does not exist?", "if", "!", "bwa", ".", "HasWriter", "(", ")", "{", "bwa", ...
// NeedsRotate evaluate if the BatchedWriterAssembly need to rotate by the FileRotateConfig
[ "NeedsRotate", "evaluate", "if", "the", "BatchedWriterAssembly", "need", "to", "rotate", "by", "the", "FileRotateConfig" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/components/batchedWriterAssembly.go#L146-L199
20,560
trivago/gollum
producer/file/pruner.go
Configure
func (pruner *Pruner) Configure(conf core.PluginConfigReader) { if pruner.pruneSize > 0 && pruner.rotate.SizeByte > 0 { pruner.pruneSize -= pruner.rotate.SizeByte >> 20 if pruner.pruneSize <= 0 { pruner.pruneCount = 1 pruner.pruneSize = 0 } } }
go
func (pruner *Pruner) Configure(conf core.PluginConfigReader) { if pruner.pruneSize > 0 && pruner.rotate.SizeByte > 0 { pruner.pruneSize -= pruner.rotate.SizeByte >> 20 if pruner.pruneSize <= 0 { pruner.pruneCount = 1 pruner.pruneSize = 0 } } }
[ "func", "(", "pruner", "*", "Pruner", ")", "Configure", "(", "conf", "core", ".", "PluginConfigReader", ")", "{", "if", "pruner", ".", "pruneSize", ">", "0", "&&", "pruner", ".", "rotate", ".", "SizeByte", ">", "0", "{", "pruner", ".", "pruneSize", "-=...
// Configure initializes this object with values from a plugin config.
[ "Configure", "initializes", "this", "object", "with", "values", "from", "a", "plugin", "config", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/producer/file/pruner.go#L55-L63
20,561
trivago/gollum
producer/file/pruner.go
Prune
func (pruner *Pruner) Prune(baseFilePath string) { if pruner.pruneHours > 0 { pruner.pruneByHour(baseFilePath, pruner.pruneHours) } if pruner.pruneCount > 0 { pruner.pruneByCount(baseFilePath, pruner.pruneCount) } if pruner.pruneSize > 0 { pruner.pruneToSize(baseFilePath, pruner.pruneSize) } }
go
func (pruner *Pruner) Prune(baseFilePath string) { if pruner.pruneHours > 0 { pruner.pruneByHour(baseFilePath, pruner.pruneHours) } if pruner.pruneCount > 0 { pruner.pruneByCount(baseFilePath, pruner.pruneCount) } if pruner.pruneSize > 0 { pruner.pruneToSize(baseFilePath, pruner.pruneSize) } }
[ "func", "(", "pruner", "*", "Pruner", ")", "Prune", "(", "baseFilePath", "string", ")", "{", "if", "pruner", ".", "pruneHours", ">", "0", "{", "pruner", ".", "pruneByHour", "(", "baseFilePath", ",", "pruner", ".", "pruneHours", ")", "\n", "}", "\n", "i...
// Prune starts prune methods by hours, by count and by size
[ "Prune", "starts", "prune", "methods", "by", "hours", "by", "count", "and", "by", "size" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/producer/file/pruner.go#L66-L76
20,562
trivago/gollum
contrib/native/kafka/librdkafka/message.go
UnmarshalBuffer
func UnmarshalBuffer(bufferPtr *C.buffer_t) []byte { length := int(bufferPtr.len) buffer := make([]byte, length) copy(buffer, (*[1 << 30]byte)(bufferPtr.data)[:length:length]) return buffer }
go
func UnmarshalBuffer(bufferPtr *C.buffer_t) []byte { length := int(bufferPtr.len) buffer := make([]byte, length) copy(buffer, (*[1 << 30]byte)(bufferPtr.data)[:length:length]) return buffer }
[ "func", "UnmarshalBuffer", "(", "bufferPtr", "*", "C", ".", "buffer_t", ")", "[", "]", "byte", "{", "length", ":=", "int", "(", "bufferPtr", ".", "len", ")", "\n", "buffer", ":=", "make", "(", "[", "]", "byte", ",", "length", ")", "\n", "copy", "("...
// UnmarshalBuffer creates a byte slice copy from a buffer_t handle.
[ "UnmarshalBuffer", "creates", "a", "byte", "slice", "copy", "from", "a", "buffer_t", "handle", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/contrib/native/kafka/librdkafka/message.go#L59-L64
20,563
trivago/gollum
contrib/native/systemd/systemdconsumer.go
Consume
func (cons *SystemdConsumer) Consume(workers *sync.WaitGroup) { cons.AddMainWorker(workers) go cons.read() cons.ControlLoop() }
go
func (cons *SystemdConsumer) Consume(workers *sync.WaitGroup) { cons.AddMainWorker(workers) go cons.read() cons.ControlLoop() }
[ "func", "(", "cons", "*", "SystemdConsumer", ")", "Consume", "(", "workers", "*", "sync", ".", "WaitGroup", ")", "{", "cons", ".", "AddMainWorker", "(", "workers", ")", "\n", "go", "cons", ".", "read", "(", ")", "\n", "cons", ".", "ControlLoop", "(", ...
// Consume enables systemd forwarding as configured.
[ "Consume", "enables", "systemd", "forwarding", "as", "configured", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/contrib/native/systemd/systemdconsumer.go#L182-L186
20,564
trivago/gollum
contrib/native/kafka/librdkafka/client.go
Poll
func (cl *Client) Poll(timeout time.Duration) { if timeout < 0 { C.rd_kafka_poll(cl.handle, -1) } else { timeoutMs := C.int(timeout.Nanoseconds() / 1000000) C.rd_kafka_poll(cl.handle, timeoutMs) } }
go
func (cl *Client) Poll(timeout time.Duration) { if timeout < 0 { C.rd_kafka_poll(cl.handle, -1) } else { timeoutMs := C.int(timeout.Nanoseconds() / 1000000) C.rd_kafka_poll(cl.handle, timeoutMs) } }
[ "func", "(", "cl", "*", "Client", ")", "Poll", "(", "timeout", "time", ".", "Duration", ")", "{", "if", "timeout", "<", "0", "{", "C", ".", "rd_kafka_poll", "(", "cl", ".", "handle", ",", "-", "1", ")", "\n", "}", "else", "{", "timeoutMs", ":=", ...
// Poll polls for new data to be sent to the async handler functions
[ "Poll", "polls", "for", "new", "data", "to", "be", "sent", "to", "the", "async", "handler", "functions" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/contrib/native/kafka/librdkafka/client.go#L63-L70
20,565
trivago/gollum
contrib/deprecated/producer/s3.go
Produce
func (prod *S3) Produce(workers *sync.WaitGroup) { prod.AddMainWorker(workers) sess, err := session.NewSessionWithOptions(session.Options{ Config: *prod.config, SharedConfigState: session.SharedConfigEnable, }) if err != nil { prod.Logger.WithError(err).Error("Failed to create session") } if pro...
go
func (prod *S3) Produce(workers *sync.WaitGroup) { prod.AddMainWorker(workers) sess, err := session.NewSessionWithOptions(session.Options{ Config: *prod.config, SharedConfigState: session.SharedConfigEnable, }) if err != nil { prod.Logger.WithError(err).Error("Failed to create session") } if pro...
[ "func", "(", "prod", "*", "S3", ")", "Produce", "(", "workers", "*", "sync", ".", "WaitGroup", ")", "{", "prod", ".", "AddMainWorker", "(", "workers", ")", "\n", "sess", ",", "err", ":=", "session", ".", "NewSessionWithOptions", "(", "session", ".", "O...
// Produce writes to a buffer that is sent to amazon s3.
[ "Produce", "writes", "to", "a", "buffer", "that", "is", "sent", "to", "amazon", "s3", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/contrib/deprecated/producer/s3.go#L587-L605
20,566
trivago/gollum
core/message.go
NewMessage
func NewMessage(source MessageSource, data []byte, metadata Metadata, streamID MessageStreamID) *Message { msg := &Message{ source: source, streamID: streamID, origStreamID: streamID, timestamp: time.Now().UnixNano(), } msg.data.payload = getPayloadCopy(data) if metadata != nil && len(metadata...
go
func NewMessage(source MessageSource, data []byte, metadata Metadata, streamID MessageStreamID) *Message { msg := &Message{ source: source, streamID: streamID, origStreamID: streamID, timestamp: time.Now().UnixNano(), } msg.data.payload = getPayloadCopy(data) if metadata != nil && len(metadata...
[ "func", "NewMessage", "(", "source", "MessageSource", ",", "data", "[", "]", "byte", ",", "metadata", "Metadata", ",", "streamID", "MessageStreamID", ")", "*", "Message", "{", "msg", ":=", "&", "Message", "{", "source", ":", "source", ",", "streamID", ":",...
// NewMessage creates a new message from a given data stream by copying data.
[ "NewMessage", "creates", "a", "new", "message", "from", "a", "given", "data", "stream", "by", "copying", "data", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/message.go#L43-L57
20,567
trivago/gollum
core/message.go
getPayloadCopy
func getPayloadCopy(data []byte) (buffer []byte) { buffer = make([]byte, len(data)) copy(buffer, data) return }
go
func getPayloadCopy(data []byte) (buffer []byte) { buffer = make([]byte, len(data)) copy(buffer, data) return }
[ "func", "getPayloadCopy", "(", "data", "[", "]", "byte", ")", "(", "buffer", "[", "]", "byte", ")", "{", "buffer", "=", "make", "(", "[", "]", "byte", ",", "len", "(", "data", ")", ")", "\n", "copy", "(", "buffer", ",", "data", ")", "\n", "retu...
// getPayloadCopy return a copy of the data byte array
[ "getPayloadCopy", "return", "a", "copy", "of", "the", "data", "byte", "array" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/message.go#L60-L64
20,568
trivago/gollum
core/message.go
SetStreamID
func (msg *Message) SetStreamID(streamID MessageStreamID) { msg.prevStreamID = msg.streamID msg.streamID = streamID }
go
func (msg *Message) SetStreamID(streamID MessageStreamID) { msg.prevStreamID = msg.streamID msg.streamID = streamID }
[ "func", "(", "msg", "*", "Message", ")", "SetStreamID", "(", "streamID", "MessageStreamID", ")", "{", "msg", ".", "prevStreamID", "=", "msg", ".", "streamID", "\n", "msg", ".", "streamID", "=", "streamID", "\n", "}" ]
// SetStreamID sets a new stream and stores the current one in the previous // stream field. This method does not affect the original stream ID.
[ "SetStreamID", "sets", "a", "new", "stream", "and", "stores", "the", "current", "one", "in", "the", "previous", "stream", "field", ".", "This", "method", "does", "not", "affect", "the", "original", "stream", "ID", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/message.go#L103-L106
20,569
trivago/gollum
core/message.go
GetMetadata
func (msg *Message) GetMetadata() Metadata { if msg.data.metadata == nil { msg.data.metadata = make(Metadata) } return msg.data.metadata }
go
func (msg *Message) GetMetadata() Metadata { if msg.data.metadata == nil { msg.data.metadata = make(Metadata) } return msg.data.metadata }
[ "func", "(", "msg", "*", "Message", ")", "GetMetadata", "(", ")", "Metadata", "{", "if", "msg", ".", "data", ".", "metadata", "==", "nil", "{", "msg", ".", "data", ".", "metadata", "=", "make", "(", "Metadata", ")", "\n", "}", "\n", "return", "msg"...
// GetMetadata returns the current Metadata. If no metadata is present, the // metadata map will be created by this call.
[ "GetMetadata", "returns", "the", "current", "Metadata", ".", "If", "no", "metadata", "is", "present", "the", "metadata", "map", "will", "be", "created", "by", "this", "call", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/message.go#L133-L138
20,570
trivago/gollum
core/message.go
StorePayload
func (msg *Message) StorePayload(data []byte) { if len(data) <= cap(msg.data.payload) { msg.data.payload = msg.data.payload[:len(data)] copy(msg.data.payload, data) } else { msg.data.payload = data } }
go
func (msg *Message) StorePayload(data []byte) { if len(data) <= cap(msg.data.payload) { msg.data.payload = msg.data.payload[:len(data)] copy(msg.data.payload, data) } else { msg.data.payload = data } }
[ "func", "(", "msg", "*", "Message", ")", "StorePayload", "(", "data", "[", "]", "byte", ")", "{", "if", "len", "(", "data", ")", "<=", "cap", "(", "msg", ".", "data", ".", "payload", ")", "{", "msg", ".", "data", ".", "payload", "=", "msg", "."...
// StorePayload copies data into the hold data buffer. If the buffer can hold // data it is resized, otherwise a new buffer will be allocated.
[ "StorePayload", "copies", "data", "into", "the", "hold", "data", "buffer", ".", "If", "the", "buffer", "can", "hold", "data", "it", "is", "resized", "otherwise", "a", "new", "buffer", "will", "be", "allocated", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/message.go#L148-L155
20,571
trivago/gollum
core/message.go
Clone
func (msg *Message) Clone() *Message { clone := *msg clone.data.payload = make([]byte, len(msg.data.payload)) copy(clone.data.payload, msg.data.payload) return &clone }
go
func (msg *Message) Clone() *Message { clone := *msg clone.data.payload = make([]byte, len(msg.data.payload)) copy(clone.data.payload, msg.data.payload) return &clone }
[ "func", "(", "msg", "*", "Message", ")", "Clone", "(", ")", "*", "Message", "{", "clone", ":=", "*", "msg", "\n\n", "clone", ".", "data", ".", "payload", "=", "make", "(", "[", "]", "byte", ",", "len", "(", "msg", ".", "data", ".", "payload", "...
// Clone returns a copy of this message, i.e. the payload is duplicated. // The created timestamp is copied, too.
[ "Clone", "returns", "a", "copy", "of", "this", "message", "i", ".", "e", ".", "the", "payload", "is", "duplicated", ".", "The", "created", "timestamp", "is", "copied", "too", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/message.go#L159-L166
20,572
trivago/gollum
core/message.go
CloneOriginal
func (msg *Message) CloneOriginal() *Message { if msg.orig == nil { msg.FreezeOriginal() } clone := *msg clone.data.payload = make([]byte, len(msg.orig.payload)) copy(clone.data.payload, msg.orig.payload) if msg.orig.metadata != nil { clone.data.metadata = msg.orig.metadata.Clone() } else { clone.data.me...
go
func (msg *Message) CloneOriginal() *Message { if msg.orig == nil { msg.FreezeOriginal() } clone := *msg clone.data.payload = make([]byte, len(msg.orig.payload)) copy(clone.data.payload, msg.orig.payload) if msg.orig.metadata != nil { clone.data.metadata = msg.orig.metadata.Clone() } else { clone.data.me...
[ "func", "(", "msg", "*", "Message", ")", "CloneOriginal", "(", ")", "*", "Message", "{", "if", "msg", ".", "orig", "==", "nil", "{", "msg", ".", "FreezeOriginal", "(", ")", "\n", "}", "\n\n", "clone", ":=", "*", "msg", "\n", "clone", ".", "data", ...
// CloneOriginal returns a copy of this message with the original payload and // stream. If FreezeOriginal has not been called before it will be at this point // so that all subsequential calls will use the same original.
[ "CloneOriginal", "returns", "a", "copy", "of", "this", "message", "with", "the", "original", "payload", "and", "stream", ".", "If", "FreezeOriginal", "has", "not", "been", "called", "before", "it", "will", "be", "at", "this", "point", "so", "that", "all", ...
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/message.go#L171-L188
20,573
trivago/gollum
core/message.go
FreezeOriginal
func (msg *Message) FreezeOriginal() { // Freeze may be called only once if msg.orig != nil { return } var metadata Metadata if msg.data.metadata != nil { metadata = msg.data.metadata.Clone() } msg.orig = &MessageData{ payload: getPayloadCopy(msg.data.payload), metadata: metadata, } }
go
func (msg *Message) FreezeOriginal() { // Freeze may be called only once if msg.orig != nil { return } var metadata Metadata if msg.data.metadata != nil { metadata = msg.data.metadata.Clone() } msg.orig = &MessageData{ payload: getPayloadCopy(msg.data.payload), metadata: metadata, } }
[ "func", "(", "msg", "*", "Message", ")", "FreezeOriginal", "(", ")", "{", "// Freeze may be called only once", "if", "msg", ".", "orig", "!=", "nil", "{", "return", "\n", "}", "\n\n", "var", "metadata", "Metadata", "\n", "if", "msg", ".", "data", ".", "m...
// FreezeOriginal will take the current state of the message and store it as // the "original" message. This function can only be called once for each // message. Please note that this function only affects payload and metadata and // can only be called once. Additional calls will have no effect. // The original stream...
[ "FreezeOriginal", "will", "take", "the", "current", "state", "of", "the", "message", "and", "store", "it", "as", "the", "original", "message", ".", "This", "function", "can", "only", "be", "called", "once", "for", "each", "message", ".", "Please", "note", ...
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/message.go#L195-L210
20,574
trivago/gollum
core/message.go
DeserializeMessage
func DeserializeMessage(data []byte) (*Message, error) { serializable := new(SerializedMessage) if err := proto.Unmarshal(data, serializable); err != nil { return nil, err } msg := &Message{ streamID: MessageStreamID(serializable.GetStreamID()), prevStreamID: MessageStreamID(serializable.GetPrevStreamID(...
go
func DeserializeMessage(data []byte) (*Message, error) { serializable := new(SerializedMessage) if err := proto.Unmarshal(data, serializable); err != nil { return nil, err } msg := &Message{ streamID: MessageStreamID(serializable.GetStreamID()), prevStreamID: MessageStreamID(serializable.GetPrevStreamID(...
[ "func", "DeserializeMessage", "(", "data", "[", "]", "byte", ")", "(", "*", "Message", ",", "error", ")", "{", "serializable", ":=", "new", "(", "SerializedMessage", ")", "\n", "if", "err", ":=", "proto", ".", "Unmarshal", "(", "data", ",", "serializable...
// DeserializeMessage generates a message from a byte array produced by // Message.Serialize. Please note that the payload is restored but the original // data is not. As of this FreezeOriginal can be called again after this call.
[ "DeserializeMessage", "generates", "a", "message", "from", "a", "byte", "array", "produced", "by", "Message", ".", "Serialize", ".", "Please", "note", "that", "the", "payload", "is", "restored", "but", "the", "original", "data", "is", "not", ".", "As", "of",...
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/message.go#L241-L266
20,575
trivago/gollum
producer/spooling.go
TryFallback
func (prod *Spooling) TryFallback(msg *core.Message) { if prod.revertOnDrop { msg.SetStreamID(msg.GetPrevStreamID()) } prod.BufferedProducer.TryFallback(msg) }
go
func (prod *Spooling) TryFallback(msg *core.Message) { if prod.revertOnDrop { msg.SetStreamID(msg.GetPrevStreamID()) } prod.BufferedProducer.TryFallback(msg) }
[ "func", "(", "prod", "*", "Spooling", ")", "TryFallback", "(", "msg", "*", "core", ".", "Message", ")", "{", "if", "prod", ".", "revertOnDrop", "{", "msg", ".", "SetStreamID", "(", "msg", ".", "GetPrevStreamID", "(", ")", ")", "\n", "}", "\n", "prod"...
// TryFallback reverts the message stream before dropping
[ "TryFallback", "reverts", "the", "message", "stream", "before", "dropping" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/producer/spooling.go#L142-L147
20,576
trivago/gollum
producer/spooling.go
openExistingFiles
func (prod *Spooling) openExistingFiles() { prod.Logger.Debug("Looking for spool files to read") files, _ := ioutil.ReadDir(prod.path) for _, file := range files { if file.IsDir() { streamName := filepath.Base(file.Name()) streamID := core.StreamRegistry.GetStreamID(streamName) // Only create a new spool...
go
func (prod *Spooling) openExistingFiles() { prod.Logger.Debug("Looking for spool files to read") files, _ := ioutil.ReadDir(prod.path) for _, file := range files { if file.IsDir() { streamName := filepath.Base(file.Name()) streamID := core.StreamRegistry.GetStreamID(streamName) // Only create a new spool...
[ "func", "(", "prod", "*", "Spooling", ")", "openExistingFiles", "(", ")", "{", "prod", ".", "Logger", ".", "Debug", "(", "\"", "\"", ")", "\n", "files", ",", "_", ":=", "ioutil", ".", "ReadDir", "(", "prod", ".", "path", ")", "\n", "for", "_", ",...
// As we might share spooling folders with different instances we only read // streams that we actually care about.
[ "As", "we", "might", "share", "spooling", "folders", "with", "different", "instances", "we", "only", "read", "streams", "that", "we", "actually", "care", "about", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/producer/spooling.go#L288-L310
20,577
trivago/gollum
core/bufferedproducer.go
DefaultDrain
func (prod *BufferedProducer) DefaultDrain() { if prod.onMessage != nil { prod.DrainMessageChannel(prod.onMessage, prod.shutdownTimeout) } }
go
func (prod *BufferedProducer) DefaultDrain() { if prod.onMessage != nil { prod.DrainMessageChannel(prod.onMessage, prod.shutdownTimeout) } }
[ "func", "(", "prod", "*", "BufferedProducer", ")", "DefaultDrain", "(", ")", "{", "if", "prod", ".", "onMessage", "!=", "nil", "{", "prod", ".", "DrainMessageChannel", "(", "prod", ".", "onMessage", ",", "prod", ".", "shutdownTimeout", ")", "\n", "}", "\...
// DefaultDrain is the function registered to onPrepareStop by default. // It calls DrainMessageChannel with the message handling function passed to // Any of the control functions. If no such call happens, this function does // nothing.
[ "DefaultDrain", "is", "the", "function", "registered", "to", "onPrepareStop", "by", "default", ".", "It", "calls", "DrainMessageChannel", "with", "the", "message", "handling", "function", "passed", "to", "Any", "of", "the", "control", "functions", ".", "If", "no...
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/bufferedproducer.go#L101-L105
20,578
trivago/gollum
core/bufferedproducer.go
DrainMessageChannel
func (prod *BufferedProducer) DrainMessageChannel(handleMessage func(*Message), timeout time.Duration) bool { for { if msg, ok := prod.messages.PopWithTimeout(timeout); ok { if !tgo.ReturnAfter(prod.shutdownTimeout, func() { handleMessage(msg) }) { return false // ### return, done ### } } else { retur...
go
func (prod *BufferedProducer) DrainMessageChannel(handleMessage func(*Message), timeout time.Duration) bool { for { if msg, ok := prod.messages.PopWithTimeout(timeout); ok { if !tgo.ReturnAfter(prod.shutdownTimeout, func() { handleMessage(msg) }) { return false // ### return, done ### } } else { retur...
[ "func", "(", "prod", "*", "BufferedProducer", ")", "DrainMessageChannel", "(", "handleMessage", "func", "(", "*", "Message", ")", ",", "timeout", "time", ".", "Duration", ")", "bool", "{", "for", "{", "if", "msg", ",", "ok", ":=", "prod", ".", "messages"...
// DrainMessageChannel empties the message channel. This functions returns // after the queue being empty for a given amount of time or when the queue // has been closed and no more messages are available. The return value // indicates wether the channel is empty or not.
[ "DrainMessageChannel", "empties", "the", "message", "channel", ".", "This", "functions", "returns", "after", "the", "queue", "being", "empty", "for", "a", "given", "amount", "of", "time", "or", "when", "the", "queue", "has", "been", "closed", "and", "no", "m...
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/bufferedproducer.go#L111-L121
20,579
trivago/gollum
core/bufferedproducer.go
DefaultClose
func (prod *BufferedProducer) DefaultClose() { if prod.onMessage != nil { prod.CloseMessageChannel(prod.onMessage) } }
go
func (prod *BufferedProducer) DefaultClose() { if prod.onMessage != nil { prod.CloseMessageChannel(prod.onMessage) } }
[ "func", "(", "prod", "*", "BufferedProducer", ")", "DefaultClose", "(", ")", "{", "if", "prod", ".", "onMessage", "!=", "nil", "{", "prod", ".", "CloseMessageChannel", "(", "prod", ".", "onMessage", ")", "\n", "}", "\n", "}" ]
// DefaultClose is the function registered to onStop by default. // It calls CloseMessageChannel with the message handling function passed to // Any of the control functions. If no such call happens, this function does // nothing.
[ "DefaultClose", "is", "the", "function", "registered", "to", "onStop", "by", "default", ".", "It", "calls", "CloseMessageChannel", "with", "the", "message", "handling", "function", "passed", "to", "Any", "of", "the", "control", "functions", ".", "If", "no", "s...
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/bufferedproducer.go#L127-L131
20,580
trivago/gollum
core/bufferedproducer.go
CloseMessageChannel
func (prod *BufferedProducer) CloseMessageChannel(handleMessage func(*Message)) (empty bool) { prod.DrainMessageChannel(handleMessage, prod.shutdownTimeout) prod.messages.Close() defer func() { if !prod.messages.IsEmpty() { prod.Logger.Errorf("%d messages left after closing.", prod.messages.GetNumQueued()) }...
go
func (prod *BufferedProducer) CloseMessageChannel(handleMessage func(*Message)) (empty bool) { prod.DrainMessageChannel(handleMessage, prod.shutdownTimeout) prod.messages.Close() defer func() { if !prod.messages.IsEmpty() { prod.Logger.Errorf("%d messages left after closing.", prod.messages.GetNumQueued()) }...
[ "func", "(", "prod", "*", "BufferedProducer", ")", "CloseMessageChannel", "(", "handleMessage", "func", "(", "*", "Message", ")", ")", "(", "empty", "bool", ")", "{", "prod", ".", "DrainMessageChannel", "(", "handleMessage", ",", "prod", ".", "shutdownTimeout"...
// CloseMessageChannel first calls DrainMessageChannel with shutdown timeout, // closes the channel afterwards and calls DrainMessageChannel again to make // sure all messages are actually gone. The return value indicates wether // the channel is empty or not.
[ "CloseMessageChannel", "first", "calls", "DrainMessageChannel", "with", "shutdown", "timeout", "closes", "the", "channel", "afterwards", "and", "calls", "DrainMessageChannel", "again", "to", "make", "sure", "all", "messages", "are", "actually", "gone", ".", "The", "...
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/bufferedproducer.go#L137-L156
20,581
trivago/gollum
core/logconsumer.go
Consume
func (cons *LogConsumer) Consume(threads *sync.WaitGroup) { // Wait for control statements for { select { case msg := <-cons.queue: cons.logRouter.Enqueue(msg) case command := <-cons.control: if command == PluginControlStopConsumer { cons.queue.Close() for msg := range cons.queue { cons.logR...
go
func (cons *LogConsumer) Consume(threads *sync.WaitGroup) { // Wait for control statements for { select { case msg := <-cons.queue: cons.logRouter.Enqueue(msg) case command := <-cons.control: if command == PluginControlStopConsumer { cons.queue.Close() for msg := range cons.queue { cons.logR...
[ "func", "(", "cons", "*", "LogConsumer", ")", "Consume", "(", "threads", "*", "sync", ".", "WaitGroup", ")", "{", "// Wait for control statements", "for", "{", "select", "{", "case", "msg", ":=", "<-", "cons", ".", "queue", ":", "cons", ".", "logRouter", ...
// Consume starts listening for control statements
[ "Consume", "starts", "listening", "for", "control", "statements" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/logconsumer.go#L98-L116
20,582
trivago/gollum
contrib/native/kafka/kafkaproducer.go
OnMessageDelivered
func (prod *KafkaProducer) OnMessageDelivered(userdata []byte) { if msg, err := core.DeserializeMessage(userdata); err == nil { prod.storeRTT(msg) } else { prod.Logger.Error(err) } }
go
func (prod *KafkaProducer) OnMessageDelivered(userdata []byte) { if msg, err := core.DeserializeMessage(userdata); err == nil { prod.storeRTT(msg) } else { prod.Logger.Error(err) } }
[ "func", "(", "prod", "*", "KafkaProducer", ")", "OnMessageDelivered", "(", "userdata", "[", "]", "byte", ")", "{", "if", "msg", ",", "err", ":=", "core", ".", "DeserializeMessage", "(", "userdata", ")", ";", "err", "==", "nil", "{", "prod", ".", "store...
// OnMessageDelivered gets called by librdkafka on message delivery success
[ "OnMessageDelivered", "gets", "called", "by", "librdkafka", "on", "message", "delivery", "success" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/contrib/native/kafka/kafkaproducer.go#L383-L389
20,583
trivago/gollum
contrib/native/kafka/kafkaproducer.go
OnMessageError
func (prod *KafkaProducer) OnMessageError(reason string, userdata []byte) { prod.Logger.Error("Message delivery failed:", reason) if msg, err := core.DeserializeMessage(userdata); err == nil { prod.storeRTT(msg) prod.TryFallback(msg) } else { prod.Logger.Error(err) } }
go
func (prod *KafkaProducer) OnMessageError(reason string, userdata []byte) { prod.Logger.Error("Message delivery failed:", reason) if msg, err := core.DeserializeMessage(userdata); err == nil { prod.storeRTT(msg) prod.TryFallback(msg) } else { prod.Logger.Error(err) } }
[ "func", "(", "prod", "*", "KafkaProducer", ")", "OnMessageError", "(", "reason", "string", ",", "userdata", "[", "]", "byte", ")", "{", "prod", ".", "Logger", ".", "Error", "(", "\"", "\"", ",", "reason", ")", "\n", "if", "msg", ",", "err", ":=", "...
// OnMessageError gets called by librdkafka on message delivery failure
[ "OnMessageError", "gets", "called", "by", "librdkafka", "on", "message", "delivery", "failure" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/contrib/native/kafka/kafkaproducer.go#L392-L400
20,584
trivago/gollum
core/pluginconfig.go
NewPluginConfig
func NewPluginConfig(pluginID string, defaultTypename string) PluginConfig { return PluginConfig{ Enable: true, ID: pluginID, Typename: defaultTypename, Settings: tcontainer.NewMarshalMap(), validKeys: make(map[string]bool), } }
go
func NewPluginConfig(pluginID string, defaultTypename string) PluginConfig { return PluginConfig{ Enable: true, ID: pluginID, Typename: defaultTypename, Settings: tcontainer.NewMarshalMap(), validKeys: make(map[string]bool), } }
[ "func", "NewPluginConfig", "(", "pluginID", "string", ",", "defaultTypename", "string", ")", "PluginConfig", "{", "return", "PluginConfig", "{", "Enable", ":", "true", ",", "ID", ":", "pluginID", ",", "Typename", ":", "defaultTypename", ",", "Settings", ":", "...
// NewPluginConfig creates a new plugin config with default values. // By default the plugin is enabled, has one instance and has no additional settings. // Passing an empty pluginID makes the plugin anonymous. // The defaultTypename may be overridden by a later call to read.
[ "NewPluginConfig", "creates", "a", "new", "plugin", "config", "with", "default", "values", ".", "By", "default", "the", "plugin", "is", "enabled", "has", "one", "instance", "and", "has", "no", "additional", "settings", ".", "Passing", "an", "empty", "pluginID"...
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/pluginconfig.go#L38-L46
20,585
trivago/gollum
core/pluginconfig.go
NewNestedPluginConfig
func NewNestedPluginConfig(defaultTypename string, values tcontainer.MarshalMap) (PluginConfig, error) { conf := NewPluginConfig("", defaultTypename) err := conf.Read(values) return conf, err }
go
func NewNestedPluginConfig(defaultTypename string, values tcontainer.MarshalMap) (PluginConfig, error) { conf := NewPluginConfig("", defaultTypename) err := conf.Read(values) return conf, err }
[ "func", "NewNestedPluginConfig", "(", "defaultTypename", "string", ",", "values", "tcontainer", ".", "MarshalMap", ")", "(", "PluginConfig", ",", "error", ")", "{", "conf", ":=", "NewPluginConfig", "(", "\"", "\"", ",", "defaultTypename", ")", "\n", "err", ":=...
// NewNestedPluginConfig creates a pluginconfig based on a given set of config // values. The plugin created does not have an id, i.e. it is considered // anonymous.
[ "NewNestedPluginConfig", "creates", "a", "pluginconfig", "based", "on", "a", "given", "set", "of", "config", "values", ".", "The", "plugin", "created", "does", "not", "have", "an", "id", "i", ".", "e", ".", "it", "is", "considered", "anonymous", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/pluginconfig.go#L51-L55
20,586
trivago/gollum
core/pluginconfig.go
registerKey
func (conf *PluginConfig) registerKey(key string) string { if _, exists := conf.validKeys[key]; exists { return key // ### return, already registered ### } // Remove array notation from path path := key startIdx := strings.IndexRune(path, tcontainer.MarshalMapArrayBegin) for startIdx > -1 { if endIdx := stri...
go
func (conf *PluginConfig) registerKey(key string) string { if _, exists := conf.validKeys[key]; exists { return key // ### return, already registered ### } // Remove array notation from path path := key startIdx := strings.IndexRune(path, tcontainer.MarshalMapArrayBegin) for startIdx > -1 { if endIdx := stri...
[ "func", "(", "conf", "*", "PluginConfig", ")", "registerKey", "(", "key", "string", ")", "string", "{", "if", "_", ",", "exists", ":=", "conf", ".", "validKeys", "[", "key", "]", ";", "exists", "{", "return", "key", "// ### return, already registered ###", ...
// registerKey registers a key to the validKeys map as lowercase and returns // the lowercase key
[ "registerKey", "registers", "a", "key", "to", "the", "validKeys", "map", "as", "lowercase", "and", "returns", "the", "lowercase", "key" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/pluginconfig.go#L59-L91
20,587
trivago/gollum
core/pluginconfig.go
Validate
func (conf PluginConfig) Validate() error { errors := tgo.NewErrorStack() errors.SetFormat(tgo.ErrorStackFormatCSV) for key := range conf.Settings { if _, exists := conf.validKeys[key]; !exists { if suggestion := conf.suggestKey(key); suggestion != "" { errors.Pushf("Unknown configuration key '%s' in '%s'. ...
go
func (conf PluginConfig) Validate() error { errors := tgo.NewErrorStack() errors.SetFormat(tgo.ErrorStackFormatCSV) for key := range conf.Settings { if _, exists := conf.validKeys[key]; !exists { if suggestion := conf.suggestKey(key); suggestion != "" { errors.Pushf("Unknown configuration key '%s' in '%s'. ...
[ "func", "(", "conf", "PluginConfig", ")", "Validate", "(", ")", "error", "{", "errors", ":=", "tgo", ".", "NewErrorStack", "(", ")", "\n", "errors", ".", "SetFormat", "(", "tgo", ".", "ErrorStackFormatCSV", ")", "\n", "for", "key", ":=", "range", "conf",...
// Validate should be called after a configuration has been processed. It will // check the keys read from the config files against the keys requested up to // this point. Unknown keys will be returned as errors
[ "Validate", "should", "be", "called", "after", "a", "configuration", "has", "been", "processed", ".", "It", "will", "check", "the", "keys", "read", "from", "the", "config", "files", "against", "the", "keys", "requested", "up", "to", "this", "point", ".", "...
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/pluginconfig.go#L116-L129
20,588
trivago/gollum
core/pluginconfig.go
Override
func (conf *PluginConfig) Override(key string, value interface{}) { key = conf.registerKey(key) conf.Settings[key] = value }
go
func (conf *PluginConfig) Override(key string, value interface{}) { key = conf.registerKey(key) conf.Settings[key] = value }
[ "func", "(", "conf", "*", "PluginConfig", ")", "Override", "(", "key", "string", ",", "value", "interface", "{", "}", ")", "{", "key", "=", "conf", ".", "registerKey", "(", "key", ")", "\n", "conf", ".", "Settings", "[", "key", "]", "=", "value", "...
// Override sets or override a configuration value for non-predefined options.
[ "Override", "sets", "or", "override", "a", "configuration", "value", "for", "non", "-", "predefined", "options", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/pluginconfig.go#L206-L209
20,589
trivago/gollum
router/distribute.go
Start
func (router *Distribute) Start() error { for _, streamID := range router.boundStreamIDs { targetRouter := core.StreamRegistry.GetRouterOrFallback(streamID) router.routers = append(router.routers, targetRouter) } return nil }
go
func (router *Distribute) Start() error { for _, streamID := range router.boundStreamIDs { targetRouter := core.StreamRegistry.GetRouterOrFallback(streamID) router.routers = append(router.routers, targetRouter) } return nil }
[ "func", "(", "router", "*", "Distribute", ")", "Start", "(", ")", "error", "{", "for", "_", ",", "streamID", ":=", "range", "router", ".", "boundStreamIDs", "{", "targetRouter", ":=", "core", ".", "StreamRegistry", ".", "GetRouterOrFallback", "(", "streamID"...
// Start the router
[ "Start", "the", "router" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/router/distribute.go#L66-L72
20,590
trivago/gollum
core/streamregistry.go
GetStreamID
func (registry *streamRegistry) GetStreamID(stream string) MessageStreamID { hash := fnv.New64a() hash.Write([]byte(stream)) streamID := MessageStreamID(hash.Sum64()) registry.nameGuard.Lock() registry.name[streamID] = stream registry.nameGuard.Unlock() return streamID }
go
func (registry *streamRegistry) GetStreamID(stream string) MessageStreamID { hash := fnv.New64a() hash.Write([]byte(stream)) streamID := MessageStreamID(hash.Sum64()) registry.nameGuard.Lock() registry.name[streamID] = stream registry.nameGuard.Unlock() return streamID }
[ "func", "(", "registry", "*", "streamRegistry", ")", "GetStreamID", "(", "stream", "string", ")", "MessageStreamID", "{", "hash", ":=", "fnv", ".", "New64a", "(", ")", "\n", "hash", ".", "Write", "(", "[", "]", "byte", "(", "stream", ")", ")", "\n", ...
// GetStreamID returns the integer representation of a given stream name.
[ "GetStreamID", "returns", "the", "integer", "representation", "of", "a", "given", "stream", "name", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/streamregistry.go#L59-L69
20,591
trivago/gollum
core/streamregistry.go
GetStreamName
func (registry streamRegistry) GetStreamName(streamID MessageStreamID) string { switch streamID { case LogInternalStreamID: return LogInternalStream case WildcardStreamID: return WildcardStream case InvalidStreamID: return InvalidStream case TraceInternalStreamID: return TraceInternalStream default: ...
go
func (registry streamRegistry) GetStreamName(streamID MessageStreamID) string { switch streamID { case LogInternalStreamID: return LogInternalStream case WildcardStreamID: return WildcardStream case InvalidStreamID: return InvalidStream case TraceInternalStreamID: return TraceInternalStream default: ...
[ "func", "(", "registry", "streamRegistry", ")", "GetStreamName", "(", "streamID", "MessageStreamID", ")", "string", "{", "switch", "streamID", "{", "case", "LogInternalStreamID", ":", "return", "LogInternalStream", "\n\n", "case", "WildcardStreamID", ":", "return", ...
// GetStreamName does a reverse lookup for a given MessageStreamID and returns // the corresponding name. If the MessageStreamID is not registered, an empty // string is returned.
[ "GetStreamName", "does", "a", "reverse", "lookup", "for", "a", "given", "MessageStreamID", "and", "returns", "the", "corresponding", "name", ".", "If", "the", "MessageStreamID", "is", "not", "registered", "an", "empty", "string", "is", "returned", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/streamregistry.go#L74-L98
20,592
trivago/gollum
core/streamregistry.go
GetRouterByStreamName
func (registry streamRegistry) GetRouterByStreamName(name string) Router { streamID := registry.GetStreamID(name) return registry.GetRouter(streamID) }
go
func (registry streamRegistry) GetRouterByStreamName(name string) Router { streamID := registry.GetStreamID(name) return registry.GetRouter(streamID) }
[ "func", "(", "registry", "streamRegistry", ")", "GetRouterByStreamName", "(", "name", "string", ")", "Router", "{", "streamID", ":=", "registry", ".", "GetStreamID", "(", "name", ")", "\n", "return", "registry", ".", "GetRouter", "(", "streamID", ")", "\n", ...
// GetRouterByStreamName returns a registered stream by name. See GetRouter.
[ "GetRouterByStreamName", "returns", "a", "registered", "stream", "by", "name", ".", "See", "GetRouter", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/streamregistry.go#L101-L104
20,593
trivago/gollum
core/streamregistry.go
GetRouter
func (registry streamRegistry) GetRouter(id MessageStreamID) Router { registry.streamGuard.RLock() stream, exists := registry.routers[id] registry.streamGuard.RUnlock() if exists { return stream } return nil }
go
func (registry streamRegistry) GetRouter(id MessageStreamID) Router { registry.streamGuard.RLock() stream, exists := registry.routers[id] registry.streamGuard.RUnlock() if exists { return stream } return nil }
[ "func", "(", "registry", "streamRegistry", ")", "GetRouter", "(", "id", "MessageStreamID", ")", "Router", "{", "registry", ".", "streamGuard", ".", "RLock", "(", ")", "\n", "stream", ",", "exists", ":=", "registry", ".", "routers", "[", "id", "]", "\n", ...
// GetRouter returns a registered stream or nil
[ "GetRouter", "returns", "a", "registered", "stream", "or", "nil" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/streamregistry.go#L107-L116
20,594
trivago/gollum
core/streamregistry.go
IsStreamRegistered
func (registry streamRegistry) IsStreamRegistered(id MessageStreamID) bool { registry.streamGuard.RLock() _, exists := registry.routers[id] registry.streamGuard.RUnlock() return exists }
go
func (registry streamRegistry) IsStreamRegistered(id MessageStreamID) bool { registry.streamGuard.RLock() _, exists := registry.routers[id] registry.streamGuard.RUnlock() return exists }
[ "func", "(", "registry", "streamRegistry", ")", "IsStreamRegistered", "(", "id", "MessageStreamID", ")", "bool", "{", "registry", ".", "streamGuard", ".", "RLock", "(", ")", "\n", "_", ",", "exists", ":=", "registry", ".", "routers", "[", "id", "]", "\n", ...
// IsStreamRegistered returns true if the stream for the given id is registered.
[ "IsStreamRegistered", "returns", "true", "if", "the", "stream", "for", "the", "given", "id", "is", "registered", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/streamregistry.go#L119-L125
20,595
trivago/gollum
core/streamregistry.go
ForEachStream
func (registry streamRegistry) ForEachStream(callback func(streamID MessageStreamID, stream Router)) { registry.streamGuard.RLock() defer registry.streamGuard.RUnlock() for streamID, router := range registry.routers { callback(streamID, router) } }
go
func (registry streamRegistry) ForEachStream(callback func(streamID MessageStreamID, stream Router)) { registry.streamGuard.RLock() defer registry.streamGuard.RUnlock() for streamID, router := range registry.routers { callback(streamID, router) } }
[ "func", "(", "registry", "streamRegistry", ")", "ForEachStream", "(", "callback", "func", "(", "streamID", "MessageStreamID", ",", "stream", "Router", ")", ")", "{", "registry", ".", "streamGuard", ".", "RLock", "(", ")", "\n", "defer", "registry", ".", "str...
// ForEachStream loops over all registered routers and calls the given function.
[ "ForEachStream", "loops", "over", "all", "registered", "routers", "and", "calls", "the", "given", "function", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/streamregistry.go#L128-L135
20,596
trivago/gollum
core/streamregistry.go
AddWildcardProducersToRouter
func (registry streamRegistry) AddWildcardProducersToRouter(router Router) { streamID := router.GetStreamID() if streamID != LogInternalStreamID { router.AddProducer(registry.wildcard...) } }
go
func (registry streamRegistry) AddWildcardProducersToRouter(router Router) { streamID := router.GetStreamID() if streamID != LogInternalStreamID { router.AddProducer(registry.wildcard...) } }
[ "func", "(", "registry", "streamRegistry", ")", "AddWildcardProducersToRouter", "(", "router", "Router", ")", "{", "streamID", ":=", "router", ".", "GetStreamID", "(", ")", "\n", "if", "streamID", "!=", "LogInternalStreamID", "{", "router", ".", "AddProducer", "...
// AddWildcardProducersToRouter adds all known wildcard producers to a given // router. The state of the wildcard list is undefined during the configuration // phase.
[ "AddWildcardProducersToRouter", "adds", "all", "known", "wildcard", "producers", "to", "a", "given", "router", ".", "The", "state", "of", "the", "wildcard", "list", "is", "undefined", "during", "the", "configuration", "phase", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/streamregistry.go#L163-L168
20,597
trivago/gollum
core/streamregistry.go
AddAllWildcardProducersToAllRouters
func (registry *streamRegistry) AddAllWildcardProducersToAllRouters() { registry.ForEachStream( func(streamID MessageStreamID, router Router) { registry.AddWildcardProducersToRouter(router) }) }
go
func (registry *streamRegistry) AddAllWildcardProducersToAllRouters() { registry.ForEachStream( func(streamID MessageStreamID, router Router) { registry.AddWildcardProducersToRouter(router) }) }
[ "func", "(", "registry", "*", "streamRegistry", ")", "AddAllWildcardProducersToAllRouters", "(", ")", "{", "registry", ".", "ForEachStream", "(", "func", "(", "streamID", "MessageStreamID", ",", "router", "Router", ")", "{", "registry", ".", "AddWildcardProducersToR...
// AddAllWildcardProducersToAllRouters executes AddWildcardProducersToRouter on // all currently registered routers
[ "AddAllWildcardProducersToAllRouters", "executes", "AddWildcardProducersToRouter", "on", "all", "currently", "registered", "routers" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/streamregistry.go#L172-L177
20,598
trivago/gollum
core/streamregistry.go
Register
func (registry *streamRegistry) Register(router Router, streamID MessageStreamID) { registry.streamGuard.RLock() _, exists := registry.routers[streamID] registry.streamGuard.RUnlock() if exists { logrus.Warningf("%T attaches to an already occupied router (%s)", router, registry.GetStreamName(streamID)) return ...
go
func (registry *streamRegistry) Register(router Router, streamID MessageStreamID) { registry.streamGuard.RLock() _, exists := registry.routers[streamID] registry.streamGuard.RUnlock() if exists { logrus.Warningf("%T attaches to an already occupied router (%s)", router, registry.GetStreamName(streamID)) return ...
[ "func", "(", "registry", "*", "streamRegistry", ")", "Register", "(", "router", "Router", ",", "streamID", "MessageStreamID", ")", "{", "registry", ".", "streamGuard", ".", "RLock", "(", ")", "\n", "_", ",", "exists", ":=", "registry", ".", "routers", "[",...
// Register registers a router plugin to a given stream id
[ "Register", "registers", "a", "router", "plugin", "to", "a", "given", "stream", "id" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/streamregistry.go#L180-L198
20,599
trivago/gollum
core/streamregistry.go
GetRouterOrFallback
func (registry *streamRegistry) GetRouterOrFallback(streamID MessageStreamID) Router { if streamID == InvalidStreamID { return nil // ### return, invalid stream does not have a router ### } registry.streamGuard.RLock() router, exists := registry.routers[streamID] registry.streamGuard.RUnlock() if exists { re...
go
func (registry *streamRegistry) GetRouterOrFallback(streamID MessageStreamID) Router { if streamID == InvalidStreamID { return nil // ### return, invalid stream does not have a router ### } registry.streamGuard.RLock() router, exists := registry.routers[streamID] registry.streamGuard.RUnlock() if exists { re...
[ "func", "(", "registry", "*", "streamRegistry", ")", "GetRouterOrFallback", "(", "streamID", "MessageStreamID", ")", "Router", "{", "if", "streamID", "==", "InvalidStreamID", "{", "return", "nil", "// ### return, invalid stream does not have a router ###", "\n", "}", "\...
// GetRouterOrFallback returns the router for the given streamID if it is registered. // If no router is registered for the given streamID the default router is used. // The default router is equivalent to an unconfigured router.Broadcast with // all wildcard producers already added.
[ "GetRouterOrFallback", "returns", "the", "router", "for", "the", "given", "streamID", "if", "it", "is", "registered", ".", "If", "no", "router", "is", "registered", "for", "the", "given", "streamID", "the", "default", "router", "is", "used", ".", "The", "def...
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/streamregistry.go#L204-L232