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,400
nanomsg/mangos-v1
compat/compat.go
Send
func (s *Socket) Send(b []byte, flags int) (int, error) { if flags != 0 { return -1, errNoFlag } m := mangos.NewMessage(len(b)) m.Body = append(m.Body, b...) // Legacy nanomsg uses the opposite semantic for negative and // zero values than mangos. A bit unfortunate. switch { case s.sto > 0: s.sock.SetOp...
go
func (s *Socket) Send(b []byte, flags int) (int, error) { if flags != 0 { return -1, errNoFlag } m := mangos.NewMessage(len(b)) m.Body = append(m.Body, b...) // Legacy nanomsg uses the opposite semantic for negative and // zero values than mangos. A bit unfortunate. switch { case s.sto > 0: s.sock.SetOp...
[ "func", "(", "s", "*", "Socket", ")", "Send", "(", "b", "[", "]", "byte", ",", "flags", "int", ")", "(", "int", ",", "error", ")", "{", "if", "flags", "!=", "0", "{", "return", "-", "1", ",", "errNoFlag", "\n", "}", "\n\n", "m", ":=", "mangos...
// Send sends a message. For AF_SP_RAW messages the header must be // included in the argument. At this time, no flags are supported.
[ "Send", "sends", "a", "message", ".", "For", "AF_SP_RAW", "messages", "the", "header", "must", "be", "included", "in", "the", "argument", ".", "At", "this", "time", "no", "flags", "are", "supported", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/compat/compat.go#L247-L268
20,401
nanomsg/mangos-v1
compat/compat.go
Linger
func (s *Socket) Linger() (time.Duration, error) { var t time.Duration return t, errNotSup }
go
func (s *Socket) Linger() (time.Duration, error) { var t time.Duration return t, errNotSup }
[ "func", "(", "s", "*", "Socket", ")", "Linger", "(", ")", "(", "time", ".", "Duration", ",", "error", ")", "{", "var", "t", "time", ".", "Duration", "\n", "return", "t", ",", "errNotSup", "\n", "}" ]
// Linger should set the TCP linger time, but at present is not supported.
[ "Linger", "should", "set", "the", "TCP", "linger", "time", "but", "at", "present", "is", "not", "supported", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/compat/compat.go#L303-L306
20,402
nanomsg/mangos-v1
compat/compat.go
NewBusSocket
func NewBusSocket() (*BusSocket, error) { s, err := NewSocket(AF_SP, BUS) return &BusSocket{s}, err }
go
func NewBusSocket() (*BusSocket, error) { s, err := NewSocket(AF_SP, BUS) return &BusSocket{s}, err }
[ "func", "NewBusSocket", "(", ")", "(", "*", "BusSocket", ",", "error", ")", "{", "s", ",", "err", ":=", "NewSocket", "(", "AF_SP", ",", "BUS", ")", "\n", "return", "&", "BusSocket", "{", "s", "}", ",", "err", "\n", "}" ]
// NewBusSocket creates a BUS socket.
[ "NewBusSocket", "creates", "a", "BUS", "socket", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/compat/compat.go#L352-L355
20,403
nanomsg/mangos-v1
compat/compat.go
NewPairSocket
func NewPairSocket() (*PairSocket, error) { s, err := NewSocket(AF_SP, PAIR) return &PairSocket{s}, err }
go
func NewPairSocket() (*PairSocket, error) { s, err := NewSocket(AF_SP, PAIR) return &PairSocket{s}, err }
[ "func", "NewPairSocket", "(", ")", "(", "*", "PairSocket", ",", "error", ")", "{", "s", ",", "err", ":=", "NewSocket", "(", "AF_SP", ",", "PAIR", ")", "\n", "return", "&", "PairSocket", "{", "s", "}", ",", "err", "\n", "}" ]
// NewPairSocket creates a PAIR socket.
[ "NewPairSocket", "creates", "a", "PAIR", "socket", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/compat/compat.go#L363-L366
20,404
nanomsg/mangos-v1
compat/compat.go
NewPubSocket
func NewPubSocket() (*PubSocket, error) { s, err := NewSocket(AF_SP, PUB) return &PubSocket{s}, err }
go
func NewPubSocket() (*PubSocket, error) { s, err := NewSocket(AF_SP, PUB) return &PubSocket{s}, err }
[ "func", "NewPubSocket", "(", ")", "(", "*", "PubSocket", ",", "error", ")", "{", "s", ",", "err", ":=", "NewSocket", "(", "AF_SP", ",", "PUB", ")", "\n", "return", "&", "PubSocket", "{", "s", "}", ",", "err", "\n", "}" ]
// NewPubSocket creates a PUB socket.
[ "NewPubSocket", "creates", "a", "PUB", "socket", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/compat/compat.go#L374-L377
20,405
nanomsg/mangos-v1
compat/compat.go
NewPullSocket
func NewPullSocket() (*PullSocket, error) { s, err := NewSocket(AF_SP, PULL) return &PullSocket{s}, err }
go
func NewPullSocket() (*PullSocket, error) { s, err := NewSocket(AF_SP, PULL) return &PullSocket{s}, err }
[ "func", "NewPullSocket", "(", ")", "(", "*", "PullSocket", ",", "error", ")", "{", "s", ",", "err", ":=", "NewSocket", "(", "AF_SP", ",", "PULL", ")", "\n", "return", "&", "PullSocket", "{", "s", "}", ",", "err", "\n", "}" ]
// NewPullSocket creates a PULL socket.
[ "NewPullSocket", "creates", "a", "PULL", "socket", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/compat/compat.go#L385-L388
20,406
nanomsg/mangos-v1
compat/compat.go
NewPushSocket
func NewPushSocket() (*PushSocket, error) { s, err := NewSocket(AF_SP, PUSH) return &PushSocket{s}, err }
go
func NewPushSocket() (*PushSocket, error) { s, err := NewSocket(AF_SP, PUSH) return &PushSocket{s}, err }
[ "func", "NewPushSocket", "(", ")", "(", "*", "PushSocket", ",", "error", ")", "{", "s", ",", "err", ":=", "NewSocket", "(", "AF_SP", ",", "PUSH", ")", "\n", "return", "&", "PushSocket", "{", "s", "}", ",", "err", "\n", "}" ]
// NewPushSocket creates a PUSH socket.
[ "NewPushSocket", "creates", "a", "PUSH", "socket", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/compat/compat.go#L396-L399
20,407
nanomsg/mangos-v1
compat/compat.go
NewRepSocket
func NewRepSocket() (*RepSocket, error) { s, err := NewSocket(AF_SP, REP) return &RepSocket{s}, err }
go
func NewRepSocket() (*RepSocket, error) { s, err := NewSocket(AF_SP, REP) return &RepSocket{s}, err }
[ "func", "NewRepSocket", "(", ")", "(", "*", "RepSocket", ",", "error", ")", "{", "s", ",", "err", ":=", "NewSocket", "(", "AF_SP", ",", "REP", ")", "\n", "return", "&", "RepSocket", "{", "s", "}", ",", "err", "\n", "}" ]
// NewRepSocket creates a REP socket.
[ "NewRepSocket", "creates", "a", "REP", "socket", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/compat/compat.go#L407-L410
20,408
nanomsg/mangos-v1
compat/compat.go
NewReqSocket
func NewReqSocket() (*ReqSocket, error) { s, err := NewSocket(AF_SP, REQ) return &ReqSocket{s}, err }
go
func NewReqSocket() (*ReqSocket, error) { s, err := NewSocket(AF_SP, REQ) return &ReqSocket{s}, err }
[ "func", "NewReqSocket", "(", ")", "(", "*", "ReqSocket", ",", "error", ")", "{", "s", ",", "err", ":=", "NewSocket", "(", "AF_SP", ",", "REQ", ")", "\n", "return", "&", "ReqSocket", "{", "s", "}", ",", "err", "\n", "}" ]
// NewReqSocket creates a REQ socket.
[ "NewReqSocket", "creates", "a", "REQ", "socket", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/compat/compat.go#L418-L421
20,409
nanomsg/mangos-v1
compat/compat.go
NewRespondentSocket
func NewRespondentSocket() (*RespondentSocket, error) { s, err := NewSocket(AF_SP, RESPONDENT) return &RespondentSocket{s}, err }
go
func NewRespondentSocket() (*RespondentSocket, error) { s, err := NewSocket(AF_SP, RESPONDENT) return &RespondentSocket{s}, err }
[ "func", "NewRespondentSocket", "(", ")", "(", "*", "RespondentSocket", ",", "error", ")", "{", "s", ",", "err", ":=", "NewSocket", "(", "AF_SP", ",", "RESPONDENT", ")", "\n", "return", "&", "RespondentSocket", "{", "s", "}", ",", "err", "\n", "}" ]
// NewRespondentSocket creates a RESPONDENT socket.
[ "NewRespondentSocket", "creates", "a", "RESPONDENT", "socket", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/compat/compat.go#L429-L432
20,410
nanomsg/mangos-v1
compat/compat.go
Subscribe
func (s *SubSocket) Subscribe(topic string) error { return s.sock.SetOption(mangos.OptionSubscribe, topic) }
go
func (s *SubSocket) Subscribe(topic string) error { return s.sock.SetOption(mangos.OptionSubscribe, topic) }
[ "func", "(", "s", "*", "SubSocket", ")", "Subscribe", "(", "topic", "string", ")", "error", "{", "return", "s", ".", "sock", ".", "SetOption", "(", "mangos", ".", "OptionSubscribe", ",", "topic", ")", "\n", "}" ]
// Subscribe registers interest in a topic.
[ "Subscribe", "registers", "interest", "in", "a", "topic", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/compat/compat.go#L440-L442
20,411
nanomsg/mangos-v1
compat/compat.go
Unsubscribe
func (s *SubSocket) Unsubscribe(topic string) error { return s.sock.SetOption(mangos.OptionUnsubscribe, topic) }
go
func (s *SubSocket) Unsubscribe(topic string) error { return s.sock.SetOption(mangos.OptionUnsubscribe, topic) }
[ "func", "(", "s", "*", "SubSocket", ")", "Unsubscribe", "(", "topic", "string", ")", "error", "{", "return", "s", ".", "sock", ".", "SetOption", "(", "mangos", ".", "OptionUnsubscribe", ",", "topic", ")", "\n", "}" ]
// Unsubscribe unregisters interest in a topic.
[ "Unsubscribe", "unregisters", "interest", "in", "a", "topic", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/compat/compat.go#L445-L447
20,412
nanomsg/mangos-v1
compat/compat.go
NewSubSocket
func NewSubSocket() (*SubSocket, error) { s, err := NewSocket(AF_SP, SUB) return &SubSocket{s}, err }
go
func NewSubSocket() (*SubSocket, error) { s, err := NewSocket(AF_SP, SUB) return &SubSocket{s}, err }
[ "func", "NewSubSocket", "(", ")", "(", "*", "SubSocket", ",", "error", ")", "{", "s", ",", "err", ":=", "NewSocket", "(", "AF_SP", ",", "SUB", ")", "\n", "return", "&", "SubSocket", "{", "s", "}", ",", "err", "\n", "}" ]
// NewSubSocket creates a SUB socket.
[ "NewSubSocket", "creates", "a", "SUB", "socket", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/compat/compat.go#L450-L453
20,413
nanomsg/mangos-v1
compat/compat.go
Deadline
func (s *SurveyorSocket) Deadline() (time.Duration, error) { var d time.Duration v, err := s.sock.GetOption(mangos.OptionSurveyTime) if err == nil { d = v.(time.Duration) } return d, err }
go
func (s *SurveyorSocket) Deadline() (time.Duration, error) { var d time.Duration v, err := s.sock.GetOption(mangos.OptionSurveyTime) if err == nil { d = v.(time.Duration) } return d, err }
[ "func", "(", "s", "*", "SurveyorSocket", ")", "Deadline", "(", ")", "(", "time", ".", "Duration", ",", "error", ")", "{", "var", "d", "time", ".", "Duration", "\n", "v", ",", "err", ":=", "s", ".", "sock", ".", "GetOption", "(", "mangos", ".", "O...
// Deadline returns the survey deadline on the socket. After this time, // responses from a survey will be discarded.
[ "Deadline", "returns", "the", "survey", "deadline", "on", "the", "socket", ".", "After", "this", "time", "responses", "from", "a", "survey", "will", "be", "discarded", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/compat/compat.go#L462-L469
20,414
nanomsg/mangos-v1
compat/compat.go
SetDeadline
func (s *SurveyorSocket) SetDeadline(d time.Duration) error { return s.sock.SetOption(mangos.OptionSurveyTime, d) }
go
func (s *SurveyorSocket) SetDeadline(d time.Duration) error { return s.sock.SetOption(mangos.OptionSurveyTime, d) }
[ "func", "(", "s", "*", "SurveyorSocket", ")", "SetDeadline", "(", "d", "time", ".", "Duration", ")", "error", "{", "return", "s", ".", "sock", ".", "SetOption", "(", "mangos", ".", "OptionSurveyTime", ",", "d", ")", "\n", "}" ]
// SetDeadline sets the survey deadline on the socket. After this time, // responses from a survey will be discarded.
[ "SetDeadline", "sets", "the", "survey", "deadline", "on", "the", "socket", ".", "After", "this", "time", "responses", "from", "a", "survey", "will", "be", "discarded", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/compat/compat.go#L473-L475
20,415
nanomsg/mangos-v1
compat/compat.go
NewSurveyorSocket
func NewSurveyorSocket() (*SurveyorSocket, error) { s, err := NewSocket(AF_SP, SURVEYOR) return &SurveyorSocket{s}, err }
go
func NewSurveyorSocket() (*SurveyorSocket, error) { s, err := NewSocket(AF_SP, SURVEYOR) return &SurveyorSocket{s}, err }
[ "func", "NewSurveyorSocket", "(", ")", "(", "*", "SurveyorSocket", ",", "error", ")", "{", "s", ",", "err", ":=", "NewSocket", "(", "AF_SP", ",", "SURVEYOR", ")", "\n", "return", "&", "SurveyorSocket", "{", "s", "}", ",", "err", "\n", "}" ]
// NewSurveyorSocket creates a SURVEYOR socket.
[ "NewSurveyorSocket", "creates", "a", "SURVEYOR", "socket", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/compat/compat.go#L478-L481
20,416
nanomsg/mangos-v1
transport/ipc/ipc_unix.go
Dial
func (d *dialer) Dial() (mangos.Pipe, error) { conn, err := net.DialUnix("unix", nil, d.addr) if err != nil { return nil, err } return mangos.NewConnPipeIPC(conn, d.sock) }
go
func (d *dialer) Dial() (mangos.Pipe, error) { conn, err := net.DialUnix("unix", nil, d.addr) if err != nil { return nil, err } return mangos.NewConnPipeIPC(conn, d.sock) }
[ "func", "(", "d", "*", "dialer", ")", "Dial", "(", ")", "(", "mangos", ".", "Pipe", ",", "error", ")", "{", "conn", ",", "err", ":=", "net", ".", "DialUnix", "(", "\"", "\"", ",", "nil", ",", "d", ".", "addr", ")", "\n", "if", "err", "!=", ...
// Dial implements the PipeDialer Dial method
[ "Dial", "implements", "the", "PipeDialer", "Dial", "method" ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/transport/ipc/ipc_unix.go#L53-L60
20,417
nanomsg/mangos-v1
core.go
SendChannel
func (sock *socket) SendChannel() <-chan *Message { sock.Lock() defer sock.Unlock() return sock.uwq }
go
func (sock *socket) SendChannel() <-chan *Message { sock.Lock() defer sock.Unlock() return sock.uwq }
[ "func", "(", "sock", "*", "socket", ")", "SendChannel", "(", ")", "<-", "chan", "*", "Message", "{", "sock", ".", "Lock", "(", ")", "\n", "defer", "sock", ".", "Unlock", "(", ")", "\n", "return", "sock", ".", "uwq", "\n", "}" ]
// Implementation of ProtocolSocket bits on socket. This is the middle // API presented to Protocol implementations.
[ "Implementation", "of", "ProtocolSocket", "bits", "on", "socket", ".", "This", "is", "the", "middle", "API", "presented", "to", "Protocol", "implementations", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/core.go#L149-L153
20,418
nanomsg/mangos-v1
core.go
Close
func (sock *socket) Close() error { fin := time.Now().Add(sock.linger) DrainChannel(sock.uwq, fin) sock.Lock() if sock.closing { sock.Unlock() return ErrClosed } sock.closing = true close(sock.closeq) for _, l := range sock.listeners { l.l.Close() } pipes := sock.pipes sock.pipes = nil sock.Unlock...
go
func (sock *socket) Close() error { fin := time.Now().Add(sock.linger) DrainChannel(sock.uwq, fin) sock.Lock() if sock.closing { sock.Unlock() return ErrClosed } sock.closing = true close(sock.closeq) for _, l := range sock.listeners { l.l.Close() } pipes := sock.pipes sock.pipes = nil sock.Unlock...
[ "func", "(", "sock", "*", "socket", ")", "Close", "(", ")", "error", "{", "fin", ":=", "time", ".", "Now", "(", ")", ".", "Add", "(", "sock", ".", "linger", ")", "\n\n", "DrainChannel", "(", "sock", ".", "uwq", ",", "fin", ")", "\n\n", "sock", ...
// // Implementation of Socket bits on socket. This is the upper API // presented to applications. //
[ "Implementation", "of", "Socket", "bits", "on", "socket", ".", "This", "is", "the", "upper", "API", "presented", "to", "applications", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/core.go#L186-L219
20,419
nanomsg/mangos-v1
core.go
String
func (sock *socket) String() string { return fmt.Sprintf("SOCKET[%s](%p)", sock.proto.Name(), sock) }
go
func (sock *socket) String() string { return fmt.Sprintf("SOCKET[%s](%p)", sock.proto.Name(), sock) }
[ "func", "(", "sock", "*", "socket", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "sock", ".", "proto", ".", "Name", "(", ")", ",", "sock", ")", "\n", "}" ]
// String just emits a very high level debug. This avoids // triggering race conditions from trying to print %v without // holding locks on structure members.
[ "String", "just", "emits", "a", "very", "high", "level", "debug", ".", "This", "avoids", "triggering", "race", "conditions", "from", "trying", "to", "print", "%v", "without", "holding", "locks", "on", "structure", "members", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/core.go#L280-L282
20,420
nanomsg/mangos-v1
core.go
dialer
func (d *dialer) dialer() { rtime := d.sock.reconntime rtmax := d.sock.reconnmax for { p, err := d.d.Dial() if err == nil { // reset retry time rtime = d.sock.reconntime d.sock.Lock() if d.closed { d.sock.Unlock() p.Close() return } d.sock.Unlock() if cp := d.sock.addPipe(p, d, n...
go
func (d *dialer) dialer() { rtime := d.sock.reconntime rtmax := d.sock.reconnmax for { p, err := d.d.Dial() if err == nil { // reset retry time rtime = d.sock.reconntime d.sock.Lock() if d.closed { d.sock.Unlock() p.Close() return } d.sock.Unlock() if cp := d.sock.addPipe(p, d, n...
[ "func", "(", "d", "*", "dialer", ")", "dialer", "(", ")", "{", "rtime", ":=", "d", ".", "sock", ".", "reconntime", "\n", "rtmax", ":=", "d", ".", "sock", ".", "reconnmax", "\n", "for", "{", "p", ",", "err", ":=", "d", ".", "d", ".", "Dial", "...
// dialer is used to dial or redial from a goroutine.
[ "dialer", "is", "used", "to", "dial", "or", "redial", "from", "a", "goroutine", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/core.go#L614-L660
20,421
nanomsg/mangos-v1
core.go
serve
func (l *listener) serve() { for { select { case <-l.sock.closeq: return default: } // If the underlying PipeListener is closed, or not // listening, we expect to return back with an error. if pipe, err := l.l.Accept(); err == nil { l.sock.addPipe(pipe, nil, l) } else if err == ErrClosed { re...
go
func (l *listener) serve() { for { select { case <-l.sock.closeq: return default: } // If the underlying PipeListener is closed, or not // listening, we expect to return back with an error. if pipe, err := l.l.Accept(); err == nil { l.sock.addPipe(pipe, nil, l) } else if err == ErrClosed { re...
[ "func", "(", "l", "*", "listener", ")", "serve", "(", ")", "{", "for", "{", "select", "{", "case", "<-", "l", ".", "sock", ".", "closeq", ":", "return", "\n", "default", ":", "}", "\n\n", "// If the underlying PipeListener is closed, or not", "// listening, ...
// serve spins in a loop, calling the accepter's Accept routine.
[ "serve", "spins", "in", "a", "loop", "calling", "the", "accepter", "s", "Accept", "routine", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/core.go#L677-L693
20,422
nanomsg/mangos-v1
protocol/pub/pub.go
sender
func (p *pub) sender() { defer p.w.Done() cq := p.sock.CloseChannel() sq := p.sock.SendChannel() for { select { case <-cq: return case m := <-sq: if m == nil { sq = p.sock.SendChannel() continue } p.Lock() for _, peer := range p.eps { m := m.Dup() select { case peer.q <-...
go
func (p *pub) sender() { defer p.w.Done() cq := p.sock.CloseChannel() sq := p.sock.SendChannel() for { select { case <-cq: return case m := <-sq: if m == nil { sq = p.sock.SendChannel() continue } p.Lock() for _, peer := range p.eps { m := m.Dup() select { case peer.q <-...
[ "func", "(", "p", "*", "pub", ")", "sender", "(", ")", "{", "defer", "p", ".", "w", ".", "Done", "(", ")", "\n\n", "cq", ":=", "p", ".", "sock", ".", "CloseChannel", "(", ")", "\n", "sq", ":=", "p", ".", "sock", ".", "SendChannel", "(", ")", ...
// Top sender.
[ "Top", "sender", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/protocol/pub/pub.go#L85-L115
20,423
nanomsg/mangos-v1
message.go
Free
func (m *Message) Free() { if v := atomic.AddInt32(&m.refcnt, -1); v > 0 { return } for i := range messageCache { if m.bsize == messageCache[i].maxbody { messageCache[i].pool.Put(m) return } } }
go
func (m *Message) Free() { if v := atomic.AddInt32(&m.refcnt, -1); v > 0 { return } for i := range messageCache { if m.bsize == messageCache[i].maxbody { messageCache[i].pool.Put(m) return } } }
[ "func", "(", "m", "*", "Message", ")", "Free", "(", ")", "{", "if", "v", ":=", "atomic", ".", "AddInt32", "(", "&", "m", ".", "refcnt", ",", "-", "1", ")", ";", "v", ">", "0", "{", "return", "\n", "}", "\n", "for", "i", ":=", "range", "mess...
// Free decrements the reference count on a message, and releases its // resources if no further references remain. While this is not // strictly necessary thanks to GC, doing so allows for the resources to // be recycled without engaging GC. This can have rather substantial // benefits for performance.
[ "Free", "decrements", "the", "reference", "count", "on", "a", "message", "and", "releases", "its", "resources", "if", "no", "further", "references", "remain", ".", "While", "this", "is", "not", "strictly", "necessary", "thanks", "to", "GC", "doing", "so", "a...
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/message.go#L115-L125
20,424
nanomsg/mangos-v1
message.go
Expired
func (m *Message) Expired() bool { if m.expire.IsZero() { return false } if m.expire.After(time.Now()) { return false } return true }
go
func (m *Message) Expired() bool { if m.expire.IsZero() { return false } if m.expire.After(time.Now()) { return false } return true }
[ "func", "(", "m", "*", "Message", ")", "Expired", "(", ")", "bool", "{", "if", "m", ".", "expire", ".", "IsZero", "(", ")", "{", "return", "false", "\n", "}", "\n", "if", "m", ".", "expire", ".", "After", "(", "time", ".", "Now", "(", ")", ")...
// Expired returns true if the message has "expired". This is used by // transport implementations to discard messages that have been // stuck in the write queue for too long, and should be discarded rather // than delivered across the transport. This is only used on the TX // path, there is no sense of "expiration" ...
[ "Expired", "returns", "true", "if", "the", "message", "has", "expired", ".", "This", "is", "used", "by", "transport", "implementations", "to", "discard", "messages", "that", "have", "been", "stuck", "in", "the", "write", "queue", "for", "too", "long", "and",...
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/message.go#L144-L152
20,425
nanomsg/mangos-v1
message.go
NewMessage
func NewMessage(sz int) *Message { var m *Message for i := range messageCache { if sz < messageCache[i].maxbody { m = messageCache[i].pool.Get().(*Message) break } } if m == nil { m = newMsg(sz) } m.refcnt = 1 m.Body = m.bbuf m.Header = m.hbuf return m }
go
func NewMessage(sz int) *Message { var m *Message for i := range messageCache { if sz < messageCache[i].maxbody { m = messageCache[i].pool.Get().(*Message) break } } if m == nil { m = newMsg(sz) } m.refcnt = 1 m.Body = m.bbuf m.Header = m.hbuf return m }
[ "func", "NewMessage", "(", "sz", "int", ")", "*", "Message", "{", "var", "m", "*", "Message", "\n", "for", "i", ":=", "range", "messageCache", "{", "if", "sz", "<", "messageCache", "[", "i", "]", ".", "maxbody", "{", "m", "=", "messageCache", "[", ...
// NewMessage is the supported way to obtain a new Message. This makes // use of a "cache" which greatly reduces the load on the garbage collector.
[ "NewMessage", "is", "the", "supported", "way", "to", "obtain", "a", "new", "Message", ".", "This", "makes", "use", "of", "a", "cache", "which", "greatly", "reduces", "the", "load", "on", "the", "garbage", "collector", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/message.go#L156-L172
20,426
nanomsg/mangos-v1
examples/websocket/reqclient.go
reqClient
func reqClient(port int) { sock, e := req.NewSocket() if e != nil { die("cannot make req socket: %v", e) } sock.AddTransport(ws.NewTransport()) url := fmt.Sprintf("ws://127.0.0.1:%d/req", port) if e = sock.Dial(url); e != nil { die("cannot dial req url: %v", e) } // Time for TCP connection set up time.Slee...
go
func reqClient(port int) { sock, e := req.NewSocket() if e != nil { die("cannot make req socket: %v", e) } sock.AddTransport(ws.NewTransport()) url := fmt.Sprintf("ws://127.0.0.1:%d/req", port) if e = sock.Dial(url); e != nil { die("cannot dial req url: %v", e) } // Time for TCP connection set up time.Slee...
[ "func", "reqClient", "(", "port", "int", ")", "{", "sock", ",", "e", ":=", "req", ".", "NewSocket", "(", ")", "\n", "if", "e", "!=", "nil", "{", "die", "(", "\"", "\"", ",", "e", ")", "\n", "}", "\n", "sock", ".", "AddTransport", "(", "ws", "...
// reqClient implements the client for REQ.
[ "reqClient", "implements", "the", "client", "for", "REQ", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/examples/websocket/reqclient.go#L26-L46
20,427
nanomsg/mangos-v1
waiter.go
WaitAbsTimeout
func (cv *CondTimed) WaitAbsTimeout(when time.Time) bool { now := time.Now() if when.After(now) { return cv.WaitRelTimeout(when.Sub(now)) } return cv.WaitRelTimeout(time.Duration(0)) }
go
func (cv *CondTimed) WaitAbsTimeout(when time.Time) bool { now := time.Now() if when.After(now) { return cv.WaitRelTimeout(when.Sub(now)) } return cv.WaitRelTimeout(time.Duration(0)) }
[ "func", "(", "cv", "*", "CondTimed", ")", "WaitAbsTimeout", "(", "when", "time", ".", "Time", ")", "bool", "{", "now", ":=", "time", ".", "Now", "(", ")", "\n", "if", "when", ".", "After", "(", "now", ")", "{", "return", "cv", ".", "WaitRelTimeout"...
// WaitAbsTimeout is like WaitRelTimeout, but expires on an absolute time // instead of a relative one.
[ "WaitAbsTimeout", "is", "like", "WaitRelTimeout", "but", "expires", "on", "an", "absolute", "time", "instead", "of", "a", "relative", "one", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/waiter.go#L43-L49
20,428
nanomsg/mangos-v1
waiter.go
Wait
func (w *Waiter) Wait() { w.Lock() for w.cnt != 0 { w.cv.Wait() } w.Unlock() }
go
func (w *Waiter) Wait() { w.Lock() for w.cnt != 0 { w.cv.Wait() } w.Unlock() }
[ "func", "(", "w", "*", "Waiter", ")", "Wait", "(", ")", "{", "w", ".", "Lock", "(", ")", "\n", "for", "w", ".", "cnt", "!=", "0", "{", "w", ".", "cv", ".", "Wait", "(", ")", "\n", "}", "\n", "w", ".", "Unlock", "(", ")", "\n", "}" ]
// Wait waits without a timeout. It only completes when the count drops // to zero.
[ "Wait", "waits", "without", "a", "timeout", ".", "It", "only", "completes", "when", "the", "count", "drops", "to", "zero", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/waiter.go#L91-L97
20,429
nanomsg/mangos-v1
waiter.go
WaitRelTimeout
func (w *Waiter) WaitRelTimeout(d time.Duration) bool { w.Lock() for w.cnt != 0 { if !w.cv.WaitRelTimeout(d) { break } } done := w.cnt == 0 w.Unlock() return done }
go
func (w *Waiter) WaitRelTimeout(d time.Duration) bool { w.Lock() for w.cnt != 0 { if !w.cv.WaitRelTimeout(d) { break } } done := w.cnt == 0 w.Unlock() return done }
[ "func", "(", "w", "*", "Waiter", ")", "WaitRelTimeout", "(", "d", "time", ".", "Duration", ")", "bool", "{", "w", ".", "Lock", "(", ")", "\n", "for", "w", ".", "cnt", "!=", "0", "{", "if", "!", "w", ".", "cv", ".", "WaitRelTimeout", "(", "d", ...
// WaitRelTimeout waits until either the count drops to zero, or the timeout // expires. It returns true if the count is zero, false otherwise.
[ "WaitRelTimeout", "waits", "until", "either", "the", "count", "drops", "to", "zero", "or", "the", "timeout", "expires", ".", "It", "returns", "true", "if", "the", "count", "is", "zero", "false", "otherwise", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/waiter.go#L101-L111
20,430
nanomsg/mangos-v1
waiter.go
WaitAbsTimeout
func (w *Waiter) WaitAbsTimeout(t time.Time) bool { w.Lock() for w.cnt != 0 { if !w.cv.WaitAbsTimeout(t) { break } } done := w.cnt == 0 w.Unlock() return done }
go
func (w *Waiter) WaitAbsTimeout(t time.Time) bool { w.Lock() for w.cnt != 0 { if !w.cv.WaitAbsTimeout(t) { break } } done := w.cnt == 0 w.Unlock() return done }
[ "func", "(", "w", "*", "Waiter", ")", "WaitAbsTimeout", "(", "t", "time", ".", "Time", ")", "bool", "{", "w", ".", "Lock", "(", ")", "\n", "for", "w", ".", "cnt", "!=", "0", "{", "if", "!", "w", ".", "cv", ".", "WaitAbsTimeout", "(", "t", ")"...
// WaitAbsTimeout is like WaitRelTimeout, but waits until an absolute time.
[ "WaitAbsTimeout", "is", "like", "WaitRelTimeout", "but", "waits", "until", "an", "absolute", "time", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/waiter.go#L114-L124
20,431
nanomsg/mangos-v1
transport.go
ResolveTCPAddr
func ResolveTCPAddr(addr string) (*net.TCPAddr, error) { if strings.HasPrefix(addr, "*") { addr = addr[1:] } return net.ResolveTCPAddr("tcp", addr) }
go
func ResolveTCPAddr(addr string) (*net.TCPAddr, error) { if strings.HasPrefix(addr, "*") { addr = addr[1:] } return net.ResolveTCPAddr("tcp", addr) }
[ "func", "ResolveTCPAddr", "(", "addr", "string", ")", "(", "*", "net", ".", "TCPAddr", ",", "error", ")", "{", "if", "strings", ".", "HasPrefix", "(", "addr", ",", "\"", "\"", ")", "{", "addr", "=", "addr", "[", "1", ":", "]", "\n", "}", "\n", ...
// ResolveTCPAddr is like net.ResolveTCPAddr, but it handles the // wildcard used in nanomsg URLs, replacing it with an empty // string to indicate that all local interfaces be used.
[ "ResolveTCPAddr", "is", "like", "net", ".", "ResolveTCPAddr", "but", "it", "handles", "the", "wildcard", "used", "in", "nanomsg", "URLs", "replacing", "it", "with", "an", "empty", "string", "to", "indicate", "that", "all", "local", "interfaces", "be", "used", ...
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/transport.go#L157-L162
20,432
nanomsg/mangos-v1
conn.go
Close
func (p *conn) Close() error { p.Lock() defer p.Unlock() if p.IsOpen() { p.open = false return p.c.Close() } return nil }
go
func (p *conn) Close() error { p.Lock() defer p.Unlock() if p.IsOpen() { p.open = false return p.c.Close() } return nil }
[ "func", "(", "p", "*", "conn", ")", "Close", "(", ")", "error", "{", "p", ".", "Lock", "(", ")", "\n", "defer", "p", ".", "Unlock", "(", ")", "\n", "if", "p", ".", "IsOpen", "(", ")", "{", "p", ".", "open", "=", "false", "\n", "return", "p"...
// Close implements the Pipe Close method.
[ "Close", "implements", "the", "Pipe", "Close", "method", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/conn.go#L107-L115
20,433
nanomsg/mangos-v1
conn.go
NewConnPipe
func NewConnPipe(c net.Conn, sock Socket, props ...interface{}) (Pipe, error) { p := &conn{c: c, proto: sock.GetProtocol(), sock: sock} if err := p.handshake(props); err != nil { return nil, err } return p, nil }
go
func NewConnPipe(c net.Conn, sock Socket, props ...interface{}) (Pipe, error) { p := &conn{c: c, proto: sock.GetProtocol(), sock: sock} if err := p.handshake(props); err != nil { return nil, err } return p, nil }
[ "func", "NewConnPipe", "(", "c", "net", ".", "Conn", ",", "sock", "Socket", ",", "props", "...", "interface", "{", "}", ")", "(", "Pipe", ",", "error", ")", "{", "p", ":=", "&", "conn", "{", "c", ":", "c", ",", "proto", ":", "sock", ".", "GetPr...
// NewConnPipe allocates a new Pipe using the supplied net.Conn, and // initializes it. It performs the handshake required at the SP layer, // only returning the Pipe once the SP layer negotiation is complete. // // Stream oriented transports can utilize this to implement a Transport. // The implementation will also n...
[ "NewConnPipe", "allocates", "a", "new", "Pipe", "using", "the", "supplied", "net", ".", "Conn", "and", "initializes", "it", ".", "It", "performs", "the", "handshake", "required", "at", "the", "SP", "layer", "only", "returning", "the", "Pipe", "once", "the", ...
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/conn.go#L138-L146
20,434
nanomsg/mangos-v1
conn.go
handshake
func (p *conn) handshake(props []interface{}) error { var err error p.props = make(map[string]interface{}) p.props[PropLocalAddr] = p.c.LocalAddr() p.props[PropRemoteAddr] = p.c.RemoteAddr() for len(props) >= 2 { switch name := props[0].(type) { case string: p.props[name] = props[1] default: return E...
go
func (p *conn) handshake(props []interface{}) error { var err error p.props = make(map[string]interface{}) p.props[PropLocalAddr] = p.c.LocalAddr() p.props[PropRemoteAddr] = p.c.RemoteAddr() for len(props) >= 2 { switch name := props[0].(type) { case string: p.props[name] = props[1] default: return E...
[ "func", "(", "p", "*", "conn", ")", "handshake", "(", "props", "[", "]", "interface", "{", "}", ")", "error", "{", "var", "err", "error", "\n\n", "p", ".", "props", "=", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", ...
// handshake establishes an SP connection between peers. Both sides must // send the header, then both sides must wait for the peer's header. // As a side effect, the peer's protocol number is stored in the conn. // Also, various properties are initialized.
[ "handshake", "establishes", "an", "SP", "connection", "between", "peers", ".", "Both", "sides", "must", "send", "the", "header", "then", "both", "sides", "must", "wait", "for", "the", "peer", "s", "header", ".", "As", "a", "side", "effect", "the", "peer", ...
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/conn.go#L162-L209
20,435
nanomsg/mangos-v1
util.go
mkTimer
func mkTimer(deadline time.Duration) <-chan time.Time { if deadline == 0 { return nil } return time.After(deadline) }
go
func mkTimer(deadline time.Duration) <-chan time.Time { if deadline == 0 { return nil } return time.After(deadline) }
[ "func", "mkTimer", "(", "deadline", "time", ".", "Duration", ")", "<-", "chan", "time", ".", "Time", "{", "if", "deadline", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "return", "time", ".", "After", "(", "deadline", ")", "\n", "}" ]
// mkTimer creates a timer based upon a duration. If however // a zero valued duration is passed, then a nil channel is passed // i.e. never selectable. This allows the output to be readily used // with deadlines in network connections, etc.
[ "mkTimer", "creates", "a", "timer", "based", "upon", "a", "duration", ".", "If", "however", "a", "zero", "valued", "duration", "is", "passed", "then", "a", "nil", "channel", "is", "passed", "i", ".", "e", ".", "never", "selectable", ".", "This", "allows"...
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/util.go#L28-L35
20,436
nanomsg/mangos-v1
perf/throughput.go
ThroughputClient
func ThroughputClient(addr string, msgSize int, count int) { s, err := pair.NewSocket() if err != nil { log.Fatalf("Failed to make new pair socket: %v", err) } defer s.Close() all.AddTransports(s) d, err := s.NewDialer(addr, nil) if err != nil { log.Fatalf("Failed to make new dialer: %v", err) } // Disab...
go
func ThroughputClient(addr string, msgSize int, count int) { s, err := pair.NewSocket() if err != nil { log.Fatalf("Failed to make new pair socket: %v", err) } defer s.Close() all.AddTransports(s) d, err := s.NewDialer(addr, nil) if err != nil { log.Fatalf("Failed to make new dialer: %v", err) } // Disab...
[ "func", "ThroughputClient", "(", "addr", "string", ",", "msgSize", "int", ",", "count", "int", ")", "{", "s", ",", "err", ":=", "pair", ".", "NewSocket", "(", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Fatalf", "(", "\"", "\"", ",", "...
// ThroughputClient is the client side of the latency test. It simply sends // the requested number of packets of given size to the server. It corresponds // to remote_thr.
[ "ThroughputClient", "is", "the", "client", "side", "of", "the", "latency", "test", ".", "It", "simply", "sends", "the", "requested", "number", "of", "packets", "of", "given", "size", "to", "the", "server", ".", "It", "corresponds", "to", "remote_thr", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/perf/throughput.go#L94-L137
20,437
nanomsg/mangos-v1
protocol/respondent/respondent.go
sender
func (peer *respPeer) sender() { for { m := <-peer.q if m == nil { break } if peer.ep.SendMsg(m) != nil { m.Free() break } } }
go
func (peer *respPeer) sender() { for { m := <-peer.q if m == nil { break } if peer.ep.SendMsg(m) != nil { m.Free() break } } }
[ "func", "(", "peer", "*", "respPeer", ")", "sender", "(", ")", "{", "for", "{", "m", ":=", "<-", "peer", ".", "q", "\n", "if", "m", "==", "nil", "{", "break", "\n", "}", "\n", "if", "peer", ".", "ep", ".", "SendMsg", "(", "m", ")", "!=", "n...
// When sending, we should have the survey ID in the header.
[ "When", "sending", "we", "should", "have", "the", "survey", "ID", "in", "the", "header", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/protocol/respondent/respondent.go#L120-L131
20,438
nanomsg/mangos-v1
transport/ipc/ipc_windows.go
Dial
func (d *dialer) Dial() (mangos.Pipe, error) { conn, err := winio.DialPipe("\\\\.\\pipe\\"+d.path, nil) if err != nil { return nil, err } addr := pipeAddr(d.path) return mangos.NewConnPipeIPC(conn, d.sock, mangos.PropLocalAddr, addr, mangos.PropRemoteAddr, addr) }
go
func (d *dialer) Dial() (mangos.Pipe, error) { conn, err := winio.DialPipe("\\\\.\\pipe\\"+d.path, nil) if err != nil { return nil, err } addr := pipeAddr(d.path) return mangos.NewConnPipeIPC(conn, d.sock, mangos.PropLocalAddr, addr, mangos.PropRemoteAddr, addr) }
[ "func", "(", "d", "*", "dialer", ")", "Dial", "(", ")", "(", "mangos", ".", "Pipe", ",", "error", ")", "{", "conn", ",", "err", ":=", "winio", ".", "DialPipe", "(", "\"", "\\\\", "\\\\", "\\\\", "\\\\", "\"", "+", "d", ".", "path", ",", "nil", ...
// Dial implements the PipeDialer Dial method.
[ "Dial", "implements", "the", "PipeDialer", "Dial", "method", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/transport/ipc/ipc_windows.go#L65-L74
20,439
nanomsg/mangos-v1
transport/ipc/ipc_windows.go
Close
func (l *listener) Close() error { if l.listener != nil { l.listener.Close() } return nil }
go
func (l *listener) Close() error { if l.listener != nil { l.listener.Close() } return nil }
[ "func", "(", "l", "*", "listener", ")", "Close", "(", ")", "error", "{", "if", "l", ".", "listener", "!=", "nil", "{", "l", ".", "listener", ".", "Close", "(", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Close implements the PipeListener Close method.
[ "Close", "implements", "the", "PipeListener", "Close", "method", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/transport/ipc/ipc_windows.go#L141-L146
20,440
nanomsg/mangos-v1
transport/ipc/ipc_windows.go
SetOption
func (l *listener) SetOption(name string, val interface{}) error { switch name { case OptionInputBufferSize: switch v := val.(type) { case int32: l.config.InputBufferSize = v return nil default: return mangos.ErrBadValue } case OptionOutputBufferSize: switch v := val.(type) { case int32: l.co...
go
func (l *listener) SetOption(name string, val interface{}) error { switch name { case OptionInputBufferSize: switch v := val.(type) { case int32: l.config.InputBufferSize = v return nil default: return mangos.ErrBadValue } case OptionOutputBufferSize: switch v := val.(type) { case int32: l.co...
[ "func", "(", "l", "*", "listener", ")", "SetOption", "(", "name", "string", ",", "val", "interface", "{", "}", ")", "error", "{", "switch", "name", "{", "case", "OptionInputBufferSize", ":", "switch", "v", ":=", "val", ".", "(", "type", ")", "{", "ca...
// SetOption implements a stub PipeListener SetOption method.
[ "SetOption", "implements", "a", "stub", "PipeListener", "SetOption", "method", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/transport/ipc/ipc_windows.go#L149-L178
20,441
nanomsg/mangos-v1
transport/ipc/ipc_windows.go
GetOption
func (l *listener) GetOption(name string) (interface{}, error) { switch name { case OptionInputBufferSize: return l.config.InputBufferSize, nil case OptionOutputBufferSize: return l.config.OutputBufferSize, nil case OptionSecurityDescriptor: return l.config.SecurityDescriptor, nil } return nil, mangos.ErrBa...
go
func (l *listener) GetOption(name string) (interface{}, error) { switch name { case OptionInputBufferSize: return l.config.InputBufferSize, nil case OptionOutputBufferSize: return l.config.OutputBufferSize, nil case OptionSecurityDescriptor: return l.config.SecurityDescriptor, nil } return nil, mangos.ErrBa...
[ "func", "(", "l", "*", "listener", ")", "GetOption", "(", "name", "string", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "switch", "name", "{", "case", "OptionInputBufferSize", ":", "return", "l", ".", "config", ".", "InputBufferSize", ",", ...
// GetOption implements a stub PipeListener GetOption method.
[ "GetOption", "implements", "a", "stub", "PipeListener", "GetOption", "method", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/transport/ipc/ipc_windows.go#L181-L191
20,442
nanomsg/mangos-v1
device.go
forwarder
func forwarder(fromSock Socket, toSock Socket) { for { m, err := fromSock.RecvMsg() if err != nil { // Probably closed socket, nothing else we can do. return } err = toSock.SendMsg(m) if err != nil { return } } }
go
func forwarder(fromSock Socket, toSock Socket) { for { m, err := fromSock.RecvMsg() if err != nil { // Probably closed socket, nothing else we can do. return } err = toSock.SendMsg(m) if err != nil { return } } }
[ "func", "forwarder", "(", "fromSock", "Socket", ",", "toSock", "Socket", ")", "{", "for", "{", "m", ",", "err", ":=", "fromSock", ".", "RecvMsg", "(", ")", "\n", "if", "err", "!=", "nil", "{", "// Probably closed socket, nothing else we can do.", "return", "...
// Forwarder takes messages from one socket, and sends them to the other. // The sockets must be of compatible types, and must be in Raw mode.
[ "Forwarder", "takes", "messages", "from", "one", "socket", "and", "sends", "them", "to", "the", "other", ".", "The", "sockets", "must", "be", "of", "compatible", "types", "and", "must", "be", "in", "Raw", "mode", "." ]
b213a8e043f6541ad45f946a2e1c5d3617987985
https://github.com/nanomsg/mangos-v1/blob/b213a8e043f6541ad45f946a2e1c5d3617987985/device.go#L64-L77
20,443
trivago/gollum
producer/scribe.go
Produce
func (prod *Scribe) Produce(workers *sync.WaitGroup) { prod.AddMainWorker(workers) prod.BatchMessageLoop(workers, prod.sendBatch) }
go
func (prod *Scribe) Produce(workers *sync.WaitGroup) { prod.AddMainWorker(workers) prod.BatchMessageLoop(workers, prod.sendBatch) }
[ "func", "(", "prod", "*", "Scribe", ")", "Produce", "(", "workers", "*", "sync", ".", "WaitGroup", ")", "{", "prod", ".", "AddMainWorker", "(", "workers", ")", "\n", "prod", ".", "BatchMessageLoop", "(", "workers", ",", "prod", ".", "sendBatch", ")", "...
// Produce writes to a buffer that is sent to scribe.
[ "Produce", "writes", "to", "a", "buffer", "that", "is", "sent", "to", "scribe", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/producer/scribe.go#L279-L282
20,444
trivago/gollum
core/components/awsMultiClient.go
NewSessionWithOptions
func (client *AwsMultiClient) NewSessionWithOptions() (*session.Session, error) { sess, err := session.NewSessionWithOptions(session.Options{ Config: *client.config, SharedConfigState: session.SharedConfigEnable, }) if err != nil { return nil, err } if client.Credentials.assumeRole != "" { cre...
go
func (client *AwsMultiClient) NewSessionWithOptions() (*session.Session, error) { sess, err := session.NewSessionWithOptions(session.Options{ Config: *client.config, SharedConfigState: session.SharedConfigEnable, }) if err != nil { return nil, err } if client.Credentials.assumeRole != "" { cre...
[ "func", "(", "client", "*", "AwsMultiClient", ")", "NewSessionWithOptions", "(", ")", "(", "*", "session", ".", "Session", ",", "error", ")", "{", "sess", ",", "err", ":=", "session", ".", "NewSessionWithOptions", "(", "session", ".", "Options", "{", "Conf...
// NewSessionWithOptions returns a instantiated asw session
[ "NewSessionWithOptions", "returns", "a", "instantiated", "asw", "session" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/components/awsMultiClient.go#L79-L95
20,445
trivago/gollum
core/components/awsMultiClient.go
CreateAwsCredentials
func (cred *AwsCredentials) CreateAwsCredentials() (*credentials.Credentials, error) { switch cred.credentialType { case credentialTypeEnv: return credentials.NewEnvCredentials(), nil case credentialTypeStatic: return credentials.NewStaticCredentials(cred.staticID, cred.staticSecret, cred.staticToken), nil ca...
go
func (cred *AwsCredentials) CreateAwsCredentials() (*credentials.Credentials, error) { switch cred.credentialType { case credentialTypeEnv: return credentials.NewEnvCredentials(), nil case credentialTypeStatic: return credentials.NewStaticCredentials(cred.staticID, cred.staticSecret, cred.staticToken), nil ca...
[ "func", "(", "cred", "*", "AwsCredentials", ")", "CreateAwsCredentials", "(", ")", "(", "*", "credentials", ".", "Credentials", ",", "error", ")", "{", "switch", "cred", ".", "credentialType", "{", "case", "credentialTypeEnv", ":", "return", "credentials", "."...
// CreateAwsCredentials returns aws credentials.Credentials for active settings
[ "CreateAwsCredentials", "returns", "aws", "credentials", ".", "Credentials", "for", "active", "settings" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/components/awsMultiClient.go#L136-L153
20,446
trivago/gollum
docs/generator/definition.go
add
func (list *DefinitionList) add(def *Definition) { list.slice = append(list.slice, def) }
go
func (list *DefinitionList) add(def *Definition) { list.slice = append(list.slice, def) }
[ "func", "(", "list", "*", "DefinitionList", ")", "add", "(", "def", "*", "Definition", ")", "{", "list", ".", "slice", "=", "append", "(", "list", ".", "slice", ",", "def", ")", "\n", "}" ]
// add appends the definition pointed to by `def` to this list
[ "add", "appends", "the", "definition", "pointed", "to", "by", "def", "to", "this", "list" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/docs/generator/definition.go#L123-L125
20,447
trivago/gollum
docs/generator/definition.go
getRST
func (list DefinitionList) getRST(paramFields bool, depth int) string { result := "" if len(list.desc) > 0 { result = fmt.Sprintf("%s\n", list.desc) } for _, def := range list.slice { // Heading if strings.Trim(def.name, " \t") != "" { result += indentLines("**"+def.name+"**", 2*depth) } else { // ...
go
func (list DefinitionList) getRST(paramFields bool, depth int) string { result := "" if len(list.desc) > 0 { result = fmt.Sprintf("%s\n", list.desc) } for _, def := range list.slice { // Heading if strings.Trim(def.name, " \t") != "" { result += indentLines("**"+def.name+"**", 2*depth) } else { // ...
[ "func", "(", "list", "DefinitionList", ")", "getRST", "(", "paramFields", "bool", ",", "depth", "int", ")", "string", "{", "result", ":=", "\"", "\"", "\n\n", "if", "len", "(", "list", ".", "desc", ")", ">", "0", "{", "result", "=", "fmt", ".", "Sp...
// getRST formats the DefinitionList as ReStructuredText
[ "getRST", "formats", "the", "DefinitionList", "as", "ReStructuredText" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/docs/generator/definition.go#L165-L211
20,448
trivago/gollum
docs/generator/definition.go
indentLines
func indentLines(source string, level int) string { return regexp.MustCompile("(?m:(^))").ReplaceAllString(source, strings.Repeat(" ", level)) }
go
func indentLines(source string, level int) string { return regexp.MustCompile("(?m:(^))").ReplaceAllString(source, strings.Repeat(" ", level)) }
[ "func", "indentLines", "(", "source", "string", ",", "level", "int", ")", "string", "{", "return", "regexp", ".", "MustCompile", "(", "\"", "\"", ")", ".", "ReplaceAllString", "(", "source", ",", "strings", ".", "Repeat", "(", "\"", "\"", ",", "level", ...
// Inserts two spaces at the beginning of each line, making the string a blockquote in RST
[ "Inserts", "two", "spaces", "at", "the", "beginning", "of", "each", "line", "making", "the", "string", "a", "blockquote", "in", "RST" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/docs/generator/definition.go#L214-L216
20,449
trivago/gollum
core/filter.go
ApplyFilter
func (filters FilterArray) ApplyFilter(msg *Message) (FilterResult, error) { for _, filter := range filters { result, err := filter.ApplyFilter(msg) if err != nil { return result, err } if result != FilterResultMessageAccept { return result, nil } } return FilterResultMessageAccept, nil }
go
func (filters FilterArray) ApplyFilter(msg *Message) (FilterResult, error) { for _, filter := range filters { result, err := filter.ApplyFilter(msg) if err != nil { return result, err } if result != FilterResultMessageAccept { return result, nil } } return FilterResultMessageAccept, nil }
[ "func", "(", "filters", "FilterArray", ")", "ApplyFilter", "(", "msg", "*", "Message", ")", "(", "FilterResult", ",", "error", ")", "{", "for", "_", ",", "filter", ":=", "range", "filters", "{", "result", ",", "err", ":=", "filter", ".", "ApplyFilter", ...
// ApplyFilter calls ApplyFilter on every filter // Return FilterResultMessageReject in case of an error or if one filter rejects
[ "ApplyFilter", "calls", "ApplyFilter", "on", "every", "filter", "Return", "FilterResultMessageReject", "in", "case", "of", "an", "error", "or", "if", "one", "filter", "rejects" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/filter.go#L28-L40
20,450
trivago/gollum
core/errors.go
NewModulateResultError
func NewModulateResultError(message string, values ...interface{}) ModulateResultError { return ModulateResultError{ message: fmt.Sprintf(message, values...), } }
go
func NewModulateResultError(message string, values ...interface{}) ModulateResultError { return ModulateResultError{ message: fmt.Sprintf(message, values...), } }
[ "func", "NewModulateResultError", "(", "message", "string", ",", "values", "...", "interface", "{", "}", ")", "ModulateResultError", "{", "return", "ModulateResultError", "{", "message", ":", "fmt", ".", "Sprintf", "(", "message", ",", "values", "...", ")", ",...
// NewModulateResultError creates a new ModulateResultError with the given // message.
[ "NewModulateResultError", "creates", "a", "new", "ModulateResultError", "with", "the", "given", "message", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/errors.go#L34-L38
20,451
trivago/gollum
producer/InfluxDB.go
sendBatch
func (prod *InfluxDB) sendBatch() core.AssemblyFunc { if prod.writer.isConnectionUp() { return prod.assembly.Write } else if prod.IsStopping() { return prod.assembly.Flush } return nil }
go
func (prod *InfluxDB) sendBatch() core.AssemblyFunc { if prod.writer.isConnectionUp() { return prod.assembly.Write } else if prod.IsStopping() { return prod.assembly.Flush } return nil }
[ "func", "(", "prod", "*", "InfluxDB", ")", "sendBatch", "(", ")", "core", ".", "AssemblyFunc", "{", "if", "prod", ".", "writer", ".", "isConnectionUp", "(", ")", "{", "return", "prod", ".", "assembly", ".", "Write", "\n", "}", "else", "if", "prod", "...
// sendBatch returns core.AssemblyFunc to flush batch
[ "sendBatch", "returns", "core", ".", "AssemblyFunc", "to", "flush", "batch" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/producer/InfluxDB.go#L109-L117
20,452
trivago/gollum
producer/InfluxDB.go
Produce
func (prod *InfluxDB) Produce(workers *sync.WaitGroup) { prod.BatchMessageLoop(workers, prod.sendBatch) }
go
func (prod *InfluxDB) Produce(workers *sync.WaitGroup) { prod.BatchMessageLoop(workers, prod.sendBatch) }
[ "func", "(", "prod", "*", "InfluxDB", ")", "Produce", "(", "workers", "*", "sync", ".", "WaitGroup", ")", "{", "prod", ".", "BatchMessageLoop", "(", "workers", ",", "prod", ".", "sendBatch", ")", "\n", "}" ]
// Produce starts a bulk producer which will collect datapoints until either the buffer is full or a timeout has been reached. // The buffer limit does not describe the number of messages received from kafka but the size of the buffer content in KB.
[ "Produce", "starts", "a", "bulk", "producer", "which", "will", "collect", "datapoints", "until", "either", "the", "buffer", "is", "full", "or", "a", "timeout", "has", "been", "reached", ".", "The", "buffer", "limit", "does", "not", "describe", "the", "number...
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/producer/InfluxDB.go#L121-L123
20,453
trivago/gollum
docs/generator/gollumplugin.go
findGollumPlugins
func findGollumPlugins(pkgRoot *ast.Package) []GollumPlugin { // Generate a tree structure from the parse results returned by AST tree := NewTree(pkgRoot) // The tree looks like this: /** *ast.Package *ast.File *ast.Ident *ast.GenDecl *ast.ImportSpec *ast...
go
func findGollumPlugins(pkgRoot *ast.Package) []GollumPlugin { // Generate a tree structure from the parse results returned by AST tree := NewTree(pkgRoot) // The tree looks like this: /** *ast.Package *ast.File *ast.Ident *ast.GenDecl *ast.ImportSpec *ast...
[ "func", "findGollumPlugins", "(", "pkgRoot", "*", "ast", ".", "Package", ")", "[", "]", "GollumPlugin", "{", "// Generate a tree structure from the parse results returned by AST", "tree", ":=", "NewTree", "(", "pkgRoot", ")", "\n\n", "// The tree looks like this:", "/**\n...
// Searches the AST rooted at `pkgRoot` for struct types representing Gollum plugins
[ "Searches", "the", "AST", "rooted", "at", "pkgRoot", "for", "struct", "types", "representing", "Gollum", "plugins" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/docs/generator/gollumplugin.go#L27-L106
20,454
trivago/gollum
logger/console_formatter.go
NewConsoleFormatter
func NewConsoleFormatter() *prefixed.TextFormatter { f := prefixed.TextFormatter{} f.ForceColors = true f.FullTimestamp = true f.ForceFormatting = true f.TimestampFormat = "2006-01-02 15:04:05 MST" f.SetColorScheme(&prefixed.ColorScheme{ PrefixStyle: "blue+h", InfoLevelStyle: "white+h", DebugLevelSty...
go
func NewConsoleFormatter() *prefixed.TextFormatter { f := prefixed.TextFormatter{} f.ForceColors = true f.FullTimestamp = true f.ForceFormatting = true f.TimestampFormat = "2006-01-02 15:04:05 MST" f.SetColorScheme(&prefixed.ColorScheme{ PrefixStyle: "blue+h", InfoLevelStyle: "white+h", DebugLevelSty...
[ "func", "NewConsoleFormatter", "(", ")", "*", "prefixed", ".", "TextFormatter", "{", "f", ":=", "prefixed", ".", "TextFormatter", "{", "}", "\n\n", "f", ".", "ForceColors", "=", "true", "\n", "f", ".", "FullTimestamp", "=", "true", "\n", "f", ".", "Force...
// NewConsoleFormatter returns a a ConsoleFormatter reference
[ "NewConsoleFormatter", "returns", "a", "a", "ConsoleFormatter", "reference" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/logger/console_formatter.go#L22-L37
20,455
trivago/gollum
core/formatter.go
ApplyFormatter
func (formatters FormatterArray) ApplyFormatter(msg *Message) error { for _, formatter := range formatters { if formatter.CanBeApplied(msg) { if err := formatter.ApplyFormatter(msg); err != nil { return err } } } return nil }
go
func (formatters FormatterArray) ApplyFormatter(msg *Message) error { for _, formatter := range formatters { if formatter.CanBeApplied(msg) { if err := formatter.ApplyFormatter(msg); err != nil { return err } } } return nil }
[ "func", "(", "formatters", "FormatterArray", ")", "ApplyFormatter", "(", "msg", "*", "Message", ")", "error", "{", "for", "_", ",", "formatter", ":=", "range", "formatters", "{", "if", "formatter", ".", "CanBeApplied", "(", "msg", ")", "{", "if", "err", ...
// ApplyFormatter calls ApplyFormatter on every formatter
[ "ApplyFormatter", "calls", "ApplyFormatter", "on", "every", "formatter" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/formatter.go#L33-L42
20,456
trivago/gollum
coordinator.go
NewCoordinator
func NewCoordinator() Coordinator { return Coordinator{ consumerWorker: new(sync.WaitGroup), producerWorker: new(sync.WaitGroup), state: coordinatorStateConfigure, } }
go
func NewCoordinator() Coordinator { return Coordinator{ consumerWorker: new(sync.WaitGroup), producerWorker: new(sync.WaitGroup), state: coordinatorStateConfigure, } }
[ "func", "NewCoordinator", "(", ")", "Coordinator", "{", "return", "Coordinator", "{", "consumerWorker", ":", "new", "(", "sync", ".", "WaitGroup", ")", ",", "producerWorker", ":", "new", "(", "sync", ".", "WaitGroup", ")", ",", "state", ":", "coordinatorStat...
// NewCoordinator creates a new multplexer
[ "NewCoordinator", "creates", "a", "new", "multplexer" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/coordinator.go#L64-L70
20,457
trivago/gollum
coordinator.go
Configure
func (co *Coordinator) Configure(conf *core.Config) error { // Make sure the log is printed to the fallback device if we are stuck here logFallback := time.AfterFunc(time.Duration(3)*time.Second, func() { logrusHookBuffer.SetTargetWriter(logger.FallbackLogDevice) logrusHookBuffer.Purge() }) defer logFallback.St...
go
func (co *Coordinator) Configure(conf *core.Config) error { // Make sure the log is printed to the fallback device if we are stuck here logFallback := time.AfterFunc(time.Duration(3)*time.Second, func() { logrusHookBuffer.SetTargetWriter(logger.FallbackLogDevice) logrusHookBuffer.Purge() }) defer logFallback.St...
[ "func", "(", "co", "*", "Coordinator", ")", "Configure", "(", "conf", "*", "core", ".", "Config", ")", "error", "{", "// Make sure the log is printed to the fallback device if we are stuck here", "logFallback", ":=", "time", ".", "AfterFunc", "(", "time", ".", "Dura...
// Configure processes the config and instantiates all valid plugins
[ "Configure", "processes", "the", "config", "and", "instantiates", "all", "valid", "plugins" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/coordinator.go#L73-L108
20,458
trivago/gollum
coordinator.go
StartPlugins
func (co *Coordinator) StartPlugins() { // Launch routers for _, router := range co.routers { logrus.Debug("Starting ", reflect.TypeOf(router)) if err := router.Start(); err != nil { logrus.WithError(err).Errorf("Failed to start router of type '%s'", reflect.TypeOf(router)) } } // Launch producers co.sta...
go
func (co *Coordinator) StartPlugins() { // Launch routers for _, router := range co.routers { logrus.Debug("Starting ", reflect.TypeOf(router)) if err := router.Start(); err != nil { logrus.WithError(err).Errorf("Failed to start router of type '%s'", reflect.TypeOf(router)) } } // Launch producers co.sta...
[ "func", "(", "co", "*", "Coordinator", ")", "StartPlugins", "(", ")", "{", "// Launch routers", "for", "_", ",", "router", ":=", "range", "co", ".", "routers", "{", "logrus", ".", "Debug", "(", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "router", ...
// StartPlugins starts all plugins in the correct order.
[ "StartPlugins", "starts", "all", "plugins", "in", "the", "correct", "order", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/coordinator.go#L111-L153
20,459
trivago/gollum
coordinator.go
Run
func (co *Coordinator) Run() { co.signal = newSignalHandler() defer signal.Stop(co.signal) logrus.Info("We be nice to them, if they be nice to us. (startup)") for { sig := <-co.signal switch translateSignal(sig) { case signalExit: logrus.Info("Master betrayed us. Wicked. Tricksy, False. (signal)") ret...
go
func (co *Coordinator) Run() { co.signal = newSignalHandler() defer signal.Stop(co.signal) logrus.Info("We be nice to them, if they be nice to us. (startup)") for { sig := <-co.signal switch translateSignal(sig) { case signalExit: logrus.Info("Master betrayed us. Wicked. Tricksy, False. (signal)") ret...
[ "func", "(", "co", "*", "Coordinator", ")", "Run", "(", ")", "{", "co", ".", "signal", "=", "newSignalHandler", "(", ")", "\n", "defer", "signal", ".", "Stop", "(", "co", ".", "signal", ")", "\n\n", "logrus", ".", "Info", "(", "\"", "\"", ")", "\...
// Run is essentially the Coordinator main loop. // It listens for shutdown signals and updates global metrics
[ "Run", "is", "essentially", "the", "Coordinator", "main", "loop", ".", "It", "listens", "for", "shutdown", "signals", "and", "updates", "global", "metrics" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/coordinator.go#L157-L181
20,460
trivago/gollum
coordinator.go
Shutdown
func (co *Coordinator) Shutdown() { logrus.Info("Filthy little hobbites. They stole it from us. (shutdown)") stateAtShutdown := co.state co.state = coordinatorStateShutdown co.shutdownConsumers(stateAtShutdown) // Make sure remaining warning / errors are written to stderr logrus.Info("I'm not listening... I'm ...
go
func (co *Coordinator) Shutdown() { logrus.Info("Filthy little hobbites. They stole it from us. (shutdown)") stateAtShutdown := co.state co.state = coordinatorStateShutdown co.shutdownConsumers(stateAtShutdown) // Make sure remaining warning / errors are written to stderr logrus.Info("I'm not listening... I'm ...
[ "func", "(", "co", "*", "Coordinator", ")", "Shutdown", "(", ")", "{", "logrus", ".", "Info", "(", "\"", "\"", ")", "\n\n", "stateAtShutdown", ":=", "co", ".", "state", "\n", "co", ".", "state", "=", "coordinatorStateShutdown", "\n\n", "co", ".", "shut...
// Shutdown all consumers and producers in a clean way. // The internal log is flushed after the consumers have been shut down so that // consumer related messages are still in the tlog. // Producers are flushed after flushing the log, so producer related shutdown // messages will be posted to stdout
[ "Shutdown", "all", "consumers", "and", "producers", "in", "a", "clean", "way", ".", "The", "internal", "log", "is", "flushed", "after", "the", "consumers", "have", "been", "shut", "down", "so", "that", "consumer", "related", "messages", "are", "still", "in",...
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/coordinator.go#L188-L206
20,461
trivago/gollum
core/simplerouter.go
Configure
func (router *SimpleRouter) Configure(conf PluginConfigReader) { router.id = conf.GetID() router.Logger = conf.GetLogger() if router.streamID == WildcardStreamID && strings.Index(router.id, GeneratedRouterPrefix) != 0 { router.Logger.Info("A wildcard stream configuration only affects the wildcard stream, not all ...
go
func (router *SimpleRouter) Configure(conf PluginConfigReader) { router.id = conf.GetID() router.Logger = conf.GetLogger() if router.streamID == WildcardStreamID && strings.Index(router.id, GeneratedRouterPrefix) != 0 { router.Logger.Info("A wildcard stream configuration only affects the wildcard stream, not all ...
[ "func", "(", "router", "*", "SimpleRouter", ")", "Configure", "(", "conf", "PluginConfigReader", ")", "{", "router", ".", "id", "=", "conf", ".", "GetID", "(", ")", "\n", "router", ".", "Logger", "=", "conf", ".", "GetLogger", "(", ")", "\n\n", "if", ...
// Configure sets up all values required by SimpleRouter.
[ "Configure", "sets", "up", "all", "values", "required", "by", "SimpleRouter", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/simplerouter.go#L51-L58
20,462
trivago/gollum
core/simplerouter.go
AddProducer
func (router *SimpleRouter) AddProducer(producers ...Producer) { for _, prod := range producers { for _, inListProd := range router.Producers { if inListProd == prod { return // ### return, already in list ### } } router.Producers = append(router.Producers, prod) } }
go
func (router *SimpleRouter) AddProducer(producers ...Producer) { for _, prod := range producers { for _, inListProd := range router.Producers { if inListProd == prod { return // ### return, already in list ### } } router.Producers = append(router.Producers, prod) } }
[ "func", "(", "router", "*", "SimpleRouter", ")", "AddProducer", "(", "producers", "...", "Producer", ")", "{", "for", "_", ",", "prod", ":=", "range", "producers", "{", "for", "_", ",", "inListProd", ":=", "range", "router", ".", "Producers", "{", "if", ...
// AddProducer adds all producers to the list of known producers. // Duplicates will be filtered.
[ "AddProducer", "adds", "all", "producers", "to", "the", "list", "of", "known", "producers", ".", "Duplicates", "will", "be", "filtered", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/simplerouter.go#L92-L101
20,463
trivago/gollum
core/simplerouter.go
Modulate
func (router *SimpleRouter) Modulate(msg *Message) ModulateResult { mod := NewFilterModulator(router.filters) return mod.Modulate(msg) }
go
func (router *SimpleRouter) Modulate(msg *Message) ModulateResult { mod := NewFilterModulator(router.filters) return mod.Modulate(msg) }
[ "func", "(", "router", "*", "SimpleRouter", ")", "Modulate", "(", "msg", "*", "Message", ")", "ModulateResult", "{", "mod", ":=", "NewFilterModulator", "(", "router", ".", "filters", ")", "\n", "return", "mod", ".", "Modulate", "(", "msg", ")", "\n", "}"...
// Modulate calls all modulators in their order of definition
[ "Modulate", "calls", "all", "modulators", "in", "their", "order", "of", "definition" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/simplerouter.go#L109-L112
20,464
trivago/gollum
producer/awss3/batchedFileWriter.go
init
func (w *BatchedFileWriter) init() { w.totalSize = 0 w.currentMultiPart = 0 w.completedParts = []*s3.CompletedPart{} w.activeBuffer = newS3ByteBuffer() w.createMultipartUpload() }
go
func (w *BatchedFileWriter) init() { w.totalSize = 0 w.currentMultiPart = 0 w.completedParts = []*s3.CompletedPart{} w.activeBuffer = newS3ByteBuffer() w.createMultipartUpload() }
[ "func", "(", "w", "*", "BatchedFileWriter", ")", "init", "(", ")", "{", "w", ".", "totalSize", "=", "0", "\n", "w", ".", "currentMultiPart", "=", "0", "\n", "w", ".", "completedParts", "=", "[", "]", "*", "s3", ".", "CompletedPart", "{", "}", "\n",...
// init BatchedFileWriter struct
[ "init", "BatchedFileWriter", "struct" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/producer/awss3/batchedFileWriter.go#L78-L85
20,465
trivago/gollum
core/pluginregistry.go
GetPlugin
func (registry *pluginRegistry) GetPlugin(ID string) Plugin { registry.guard.RLock() plugin, exists := registry.plugins[ID] registry.guard.RUnlock() if exists { return plugin } return nil }
go
func (registry *pluginRegistry) GetPlugin(ID string) Plugin { registry.guard.RLock() plugin, exists := registry.plugins[ID] registry.guard.RUnlock() if exists { return plugin } return nil }
[ "func", "(", "registry", "*", "pluginRegistry", ")", "GetPlugin", "(", "ID", "string", ")", "Plugin", "{", "registry", ".", "guard", ".", "RLock", "(", ")", "\n", "plugin", ",", "exists", ":=", "registry", ".", "plugins", "[", "ID", "]", "\n", "registr...
// GetPlugin returns a plugin by name or nil if not found.
[ "GetPlugin", "returns", "a", "plugin", "by", "name", "or", "nil", "if", "not", "found", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/pluginregistry.go#L47-L56
20,466
trivago/gollum
core/pluginregistry.go
GetPluginWithState
func (registry *pluginRegistry) GetPluginWithState(ID string) PluginWithState { plugin := registry.GetPlugin(ID) if pluginWithState, hasState := plugin.(PluginWithState); hasState { return pluginWithState } return nil }
go
func (registry *pluginRegistry) GetPluginWithState(ID string) PluginWithState { plugin := registry.GetPlugin(ID) if pluginWithState, hasState := plugin.(PluginWithState); hasState { return pluginWithState } return nil }
[ "func", "(", "registry", "*", "pluginRegistry", ")", "GetPluginWithState", "(", "ID", "string", ")", "PluginWithState", "{", "plugin", ":=", "registry", ".", "GetPlugin", "(", "ID", ")", "\n", "if", "pluginWithState", ",", "hasState", ":=", "plugin", ".", "(...
// GetPluginWithState returns a plugin by name if it has a state or nil.
[ "GetPluginWithState", "returns", "a", "plugin", "by", "name", "if", "it", "has", "a", "state", "or", "nil", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/pluginregistry.go#L59-L65
20,467
trivago/gollum
core/messagebatch.go
AppendOrBlock
func (batch *MessageBatch) AppendOrBlock(msg *Message) bool { spin := tsync.NewSpinner(tsync.SpinPriorityMedium) for !batch.IsClosed() { if batch.Append(msg) { return true // ### return, success ### } spin.Yield() } return false }
go
func (batch *MessageBatch) AppendOrBlock(msg *Message) bool { spin := tsync.NewSpinner(tsync.SpinPriorityMedium) for !batch.IsClosed() { if batch.Append(msg) { return true // ### return, success ### } spin.Yield() } return false }
[ "func", "(", "batch", "*", "MessageBatch", ")", "AppendOrBlock", "(", "msg", "*", "Message", ")", "bool", "{", "spin", ":=", "tsync", ".", "NewSpinner", "(", "tsync", ".", "SpinPriorityMedium", ")", "\n", "for", "!", "batch", ".", "IsClosed", "(", ")", ...
// AppendOrBlock works like Append but will block until Append returns true. // If the batch was closed during this call, false is returned.
[ "AppendOrBlock", "works", "like", "Append", "but", "will", "block", "until", "Append", "returns", "true", ".", "If", "the", "batch", "was", "closed", "during", "this", "call", "false", "is", "returned", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/messagebatch.go#L110-L120
20,468
trivago/gollum
core/messagebatch.go
Touch
func (batch *MessageBatch) Touch() { atomic.StoreInt64(batch.lastFlush, time.Now().Unix()) }
go
func (batch *MessageBatch) Touch() { atomic.StoreInt64(batch.lastFlush, time.Now().Unix()) }
[ "func", "(", "batch", "*", "MessageBatch", ")", "Touch", "(", ")", "{", "atomic", ".", "StoreInt64", "(", "batch", ".", "lastFlush", ",", "time", ".", "Now", "(", ")", ".", "Unix", "(", ")", ")", "\n", "}" ]
// Touch resets the timer queried by ReachedTimeThreshold, i.e. this resets the // automatic flush timeout
[ "Touch", "resets", "the", "timer", "queried", "by", "ReachedTimeThreshold", "i", ".", "e", ".", "this", "resets", "the", "automatic", "flush", "timeout" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/messagebatch.go#L137-L139
20,469
trivago/gollum
core/messagebatch.go
Close
func (batch *MessageBatch) Close(assemble AssemblyFunc, timeout time.Duration) { atomic.StoreInt32(batch.closed, 1) batch.Flush(assemble) batch.WaitForFlush(timeout) }
go
func (batch *MessageBatch) Close(assemble AssemblyFunc, timeout time.Duration) { atomic.StoreInt32(batch.closed, 1) batch.Flush(assemble) batch.WaitForFlush(timeout) }
[ "func", "(", "batch", "*", "MessageBatch", ")", "Close", "(", "assemble", "AssemblyFunc", ",", "timeout", "time", ".", "Duration", ")", "{", "atomic", ".", "StoreInt32", "(", "batch", ".", "closed", ",", "1", ")", "\n", "batch", ".", "Flush", "(", "ass...
// Close disables Append, calls flush and waits for this call to finish. // Timeout is passed to WaitForFlush.
[ "Close", "disables", "Append", "calls", "flush", "and", "waits", "for", "this", "call", "to", "finish", ".", "Timeout", "is", "passed", "to", "WaitForFlush", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/messagebatch.go#L143-L147
20,470
trivago/gollum
core/messagebatch.go
AfterFlushDo
func (batch *MessageBatch) AfterFlushDo(callback func() error) error { batch.flushing.IncWhenDone() defer batch.flushing.Done() return callback() }
go
func (batch *MessageBatch) AfterFlushDo(callback func() error) error { batch.flushing.IncWhenDone() defer batch.flushing.Done() return callback() }
[ "func", "(", "batch", "*", "MessageBatch", ")", "AfterFlushDo", "(", "callback", "func", "(", ")", "error", ")", "error", "{", "batch", ".", "flushing", ".", "IncWhenDone", "(", ")", "\n", "defer", "batch", ".", "flushing", ".", "Done", "(", ")", "\n",...
// AfterFlushDo calls a function after a currently running flush is done. // It also blocks any flush during the execution of callback. // Returns the error returned by callback
[ "AfterFlushDo", "calls", "a", "function", "after", "a", "currently", "running", "flush", "is", "done", ".", "It", "also", "blocks", "any", "flush", "during", "the", "execution", "of", "callback", ".", "Returns", "the", "error", "returned", "by", "callback" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/messagebatch.go#L201-L205
20,471
trivago/gollum
core/messagebatch.go
WaitForFlush
func (batch *MessageBatch) WaitForFlush(timeout time.Duration) { batch.flushing.WaitFor(timeout) }
go
func (batch *MessageBatch) WaitForFlush(timeout time.Duration) { batch.flushing.WaitFor(timeout) }
[ "func", "(", "batch", "*", "MessageBatch", ")", "WaitForFlush", "(", "timeout", "time", ".", "Duration", ")", "{", "batch", ".", "flushing", ".", "WaitFor", "(", "timeout", ")", "\n", "}" ]
// WaitForFlush blocks until the current flush command returns. // Passing a timeout > 0 will unblock this function after the given duration at // the latest.
[ "WaitForFlush", "blocks", "until", "the", "current", "flush", "command", "returns", ".", "Passing", "a", "timeout", ">", "0", "will", "unblock", "this", "function", "after", "the", "given", "duration", "at", "the", "latest", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/messagebatch.go#L210-L212
20,472
trivago/gollum
core/messagebatch.go
ReachedSizeThreshold
func (batch MessageBatch) ReachedSizeThreshold(size int) bool { activeIdx := atomic.LoadUint32(batch.activeSet) >> messageBatchIndexShift threshold := uint32(tmath.MaxI(size, len(batch.queue[activeIdx].messages))) return atomic.LoadUint32(batch.queue[activeIdx].doneCount) >= threshold }
go
func (batch MessageBatch) ReachedSizeThreshold(size int) bool { activeIdx := atomic.LoadUint32(batch.activeSet) >> messageBatchIndexShift threshold := uint32(tmath.MaxI(size, len(batch.queue[activeIdx].messages))) return atomic.LoadUint32(batch.queue[activeIdx].doneCount) >= threshold }
[ "func", "(", "batch", "MessageBatch", ")", "ReachedSizeThreshold", "(", "size", "int", ")", "bool", "{", "activeIdx", ":=", "atomic", ".", "LoadUint32", "(", "batch", ".", "activeSet", ")", ">>", "messageBatchIndexShift", "\n", "threshold", ":=", "uint32", "("...
// ReachedSizeThreshold returns true if the bytes stored in the buffer are // above or equal to the size given. // If there is no data this function returns false.
[ "ReachedSizeThreshold", "returns", "true", "if", "the", "bytes", "stored", "in", "the", "buffer", "are", "above", "or", "equal", "to", "the", "size", "given", ".", "If", "there", "is", "no", "data", "this", "function", "returns", "false", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/messagebatch.go#L223-L227
20,473
trivago/gollum
core/messagebatch.go
ReachedTimeThreshold
func (batch MessageBatch) ReachedTimeThreshold(timeout time.Duration) bool { lastFlush := time.Unix(atomic.LoadInt64(batch.lastFlush), 0) return !batch.IsEmpty() && time.Since(lastFlush) > timeout }
go
func (batch MessageBatch) ReachedTimeThreshold(timeout time.Duration) bool { lastFlush := time.Unix(atomic.LoadInt64(batch.lastFlush), 0) return !batch.IsEmpty() && time.Since(lastFlush) > timeout }
[ "func", "(", "batch", "MessageBatch", ")", "ReachedTimeThreshold", "(", "timeout", "time", ".", "Duration", ")", "bool", "{", "lastFlush", ":=", "time", ".", "Unix", "(", "atomic", ".", "LoadInt64", "(", "batch", ".", "lastFlush", ")", ",", "0", ")", "\n...
// ReachedTimeThreshold returns true if the last flush was more than timeout ago. // If there is no data this function returns false.
[ "ReachedTimeThreshold", "returns", "true", "if", "the", "last", "flush", "was", "more", "than", "timeout", "ago", ".", "If", "there", "is", "no", "data", "this", "function", "returns", "false", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/messagebatch.go#L231-L234
20,474
trivago/gollum
core/config.go
ReadConfig
func ReadConfig(buffer []byte) (*Config, error) { config := new(Config) if err := yaml.Unmarshal(buffer, &config.Values); err != nil { return nil, err } // As there might be multiple instances of the same plugin class we iterate // over an array here. hasError := false for pluginID, configValues := range conf...
go
func ReadConfig(buffer []byte) (*Config, error) { config := new(Config) if err := yaml.Unmarshal(buffer, &config.Values); err != nil { return nil, err } // As there might be multiple instances of the same plugin class we iterate // over an array here. hasError := false for pluginID, configValues := range conf...
[ "func", "ReadConfig", "(", "buffer", "[", "]", "byte", ")", "(", "*", "Config", ",", "error", ")", "{", "config", ":=", "new", "(", "Config", ")", "\n", "if", "err", ":=", "yaml", ".", "Unmarshal", "(", "buffer", ",", "&", "config", ".", "Values", ...
// ReadConfig creates a config from a yaml byte stream.
[ "ReadConfig", "creates", "a", "config", "from", "a", "yaml", "byte", "stream", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/config.go#L44-L95
20,475
trivago/gollum
core/config.go
ReadConfigFromFile
func ReadConfigFromFile(path string) (*Config, error) { buffer, err := ioutil.ReadFile(path) if err != nil { return nil, err } return ReadConfig(buffer) }
go
func ReadConfigFromFile(path string) (*Config, error) { buffer, err := ioutil.ReadFile(path) if err != nil { return nil, err } return ReadConfig(buffer) }
[ "func", "ReadConfigFromFile", "(", "path", "string", ")", "(", "*", "Config", ",", "error", ")", "{", "buffer", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "...
// ReadConfigFromFile parses a YAML config file into a new Config struct.
[ "ReadConfigFromFile", "parses", "a", "YAML", "config", "file", "into", "a", "new", "Config", "struct", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/config.go#L98-L105
20,476
trivago/gollum
core/config.go
Validate
func (conf *Config) Validate() error { errors := tgo.NewErrorStack() errors.SetFormat(tgo.ErrorStackFormatCSV) for _, config := range conf.Plugins { if config.Typename == "" { errors.Pushf("Plugin type is not set for '%s'", config.ID) continue } pluginType := TypeRegistry.GetTypeOf(config.Typename) i...
go
func (conf *Config) Validate() error { errors := tgo.NewErrorStack() errors.SetFormat(tgo.ErrorStackFormatCSV) for _, config := range conf.Plugins { if config.Typename == "" { errors.Pushf("Plugin type is not set for '%s'", config.ID) continue } pluginType := TypeRegistry.GetTypeOf(config.Typename) i...
[ "func", "(", "conf", "*", "Config", ")", "Validate", "(", ")", "error", "{", "errors", ":=", "tgo", ".", "NewErrorStack", "(", ")", "\n", "errors", ".", "SetFormat", "(", "tgo", ".", "ErrorStackFormatCSV", ")", "\n\n", "for", "_", ",", "config", ":=", ...
// Validate checks all plugin configs and plugins on validity. I.e. it checks // on mandatory fields and correct implementation of consumer, producer or // stream interface. It does NOT call configure for each plugin.
[ "Validate", "checks", "all", "plugin", "configs", "and", "plugins", "on", "validity", ".", "I", ".", "e", ".", "it", "checks", "on", "mandatory", "fields", "and", "correct", "implementation", "of", "consumer", "producer", "or", "stream", "interface", ".", "I...
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/config.go#L110-L147
20,477
trivago/gollum
core/config.go
GetConsumers
func (conf *Config) GetConsumers() []PluginConfig { configs := []PluginConfig{} for _, config := range conf.Plugins { if !config.Enable || config.Typename == "" { continue // ### continue, disabled ### } pluginType := TypeRegistry.GetTypeOf(config.Typename) if pluginType == nil { continue // ### conti...
go
func (conf *Config) GetConsumers() []PluginConfig { configs := []PluginConfig{} for _, config := range conf.Plugins { if !config.Enable || config.Typename == "" { continue // ### continue, disabled ### } pluginType := TypeRegistry.GetTypeOf(config.Typename) if pluginType == nil { continue // ### conti...
[ "func", "(", "conf", "*", "Config", ")", "GetConsumers", "(", ")", "[", "]", "PluginConfig", "{", "configs", ":=", "[", "]", "PluginConfig", "{", "}", "\n\n", "for", "_", ",", "config", ":=", "range", "conf", ".", "Plugins", "{", "if", "!", "config",...
// GetConsumers returns all consumer plugins from the config
[ "GetConsumers", "returns", "all", "consumer", "plugins", "from", "the", "config" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/config.go#L150-L170
20,478
trivago/gollum
core/config.go
GetRouters
func (conf *Config) GetRouters() []PluginConfig { configs := []PluginConfig{} for _, config := range conf.Plugins { if !config.Enable || config.Typename == "" { continue // ### continue, disabled ### } pluginType := TypeRegistry.GetTypeOf(config.Typename) if pluginType == nil { continue // ### continu...
go
func (conf *Config) GetRouters() []PluginConfig { configs := []PluginConfig{} for _, config := range conf.Plugins { if !config.Enable || config.Typename == "" { continue // ### continue, disabled ### } pluginType := TypeRegistry.GetTypeOf(config.Typename) if pluginType == nil { continue // ### continu...
[ "func", "(", "conf", "*", "Config", ")", "GetRouters", "(", ")", "[", "]", "PluginConfig", "{", "configs", ":=", "[", "]", "PluginConfig", "{", "}", "\n\n", "for", "_", ",", "config", ":=", "range", "conf", ".", "Plugins", "{", "if", "!", "config", ...
// GetRouters returns all stream plugins from the config
[ "GetRouters", "returns", "all", "stream", "plugins", "from", "the", "config" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/config.go#L196-L216
20,479
trivago/gollum
contrib/native/kafka/librdkafka/topic.go
Close
func (t *Topic) Close() { oldQueueLen := C.int(0x7FFFFFFF) queueLen := C.rd_kafka_outq_len(t.client.handle) // Wait as long as we're flushing for queueLen > 0 && queueLen < oldQueueLen { C.rd_kafka_poll(t.client.handle, 1000) oldQueueLen = queueLen queueLen = C.rd_kafka_outq_len(t.client.handle) } if queu...
go
func (t *Topic) Close() { oldQueueLen := C.int(0x7FFFFFFF) queueLen := C.rd_kafka_outq_len(t.client.handle) // Wait as long as we're flushing for queueLen > 0 && queueLen < oldQueueLen { C.rd_kafka_poll(t.client.handle, 1000) oldQueueLen = queueLen queueLen = C.rd_kafka_outq_len(t.client.handle) } if queu...
[ "func", "(", "t", "*", "Topic", ")", "Close", "(", ")", "{", "oldQueueLen", ":=", "C", ".", "int", "(", "0x7FFFFFFF", ")", "\n", "queueLen", ":=", "C", ".", "rd_kafka_outq_len", "(", "t", ".", "client", ".", "handle", ")", "\n\n", "// Wait as long as w...
// Close frees the internal handle and tries to flush the queue.
[ "Close", "frees", "the", "internal", "handle", "and", "tries", "to", "flush", "the", "queue", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/contrib/native/kafka/librdkafka/topic.go#L44-L59
20,480
trivago/gollum
main.go
initLogrus
func initLogrus() func() { // Initialize logger.LogrusHookBuffer logrusHookBuffer = logger.NewLogrusHookBuffer() // Initialize logging. All logging is done via logrusHookBuffer; // logrus's output writer is always set to ioutil.Discard. logrus.AddHook(&logrusHookBuffer) logrus.SetOutput(ioutil.Discard) logrus.S...
go
func initLogrus() func() { // Initialize logger.LogrusHookBuffer logrusHookBuffer = logger.NewLogrusHookBuffer() // Initialize logging. All logging is done via logrusHookBuffer; // logrus's output writer is always set to ioutil.Discard. logrus.AddHook(&logrusHookBuffer) logrus.SetOutput(ioutil.Discard) logrus.S...
[ "func", "initLogrus", "(", ")", "func", "(", ")", "{", "// Initialize logger.LogrusHookBuffer", "logrusHookBuffer", "=", "logger", ".", "NewLogrusHookBuffer", "(", ")", "\n\n", "// Initialize logging. All logging is done via logrusHookBuffer;", "// logrus's output writer is alway...
// initLogrus initializes the logging framework
[ "initLogrus", "initializes", "the", "logging", "framework" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/main.go#L155-L183
20,481
trivago/gollum
main.go
readConfig
func readConfig(configFile string) *core.Config { if *flagHelp || configFile == "" { logrus.Error("Please provide a config file") return nil } config, err := core.ReadConfigFromFile(configFile) if err != nil { logrus.WithError(err).Error("Failed to read config") return nil } if err := config.Validate();...
go
func readConfig(configFile string) *core.Config { if *flagHelp || configFile == "" { logrus.Error("Please provide a config file") return nil } config, err := core.ReadConfigFromFile(configFile) if err != nil { logrus.WithError(err).Error("Failed to read config") return nil } if err := config.Validate();...
[ "func", "readConfig", "(", "configFile", "string", ")", "*", "core", ".", "Config", "{", "if", "*", "flagHelp", "||", "configFile", "==", "\"", "\"", "{", "logrus", ".", "Error", "(", "\"", "\"", ")", "\n", "return", "nil", "\n", "}", "\n\n", "config...
// readConfig reads and checks the config file for errors.
[ "readConfig", "reads", "and", "checks", "the", "config", "file", "for", "errors", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/main.go#L186-L204
20,482
trivago/gollum
main.go
configureRuntime
func configureRuntime() { if *flagPidFile != "" { err := ioutil.WriteFile(*flagPidFile, []byte(strconv.Itoa(os.Getpid())), 0644) if err != nil { logrus.WithError(err).Error("Failed to write pid file") } } if *flagNumCPU == 0 { runtime.GOMAXPROCS(runtime.NumCPU()) } else { runtime.GOMAXPROCS(*flagNumCP...
go
func configureRuntime() { if *flagPidFile != "" { err := ioutil.WriteFile(*flagPidFile, []byte(strconv.Itoa(os.Getpid())), 0644) if err != nil { logrus.WithError(err).Error("Failed to write pid file") } } if *flagNumCPU == 0 { runtime.GOMAXPROCS(runtime.NumCPU()) } else { runtime.GOMAXPROCS(*flagNumCP...
[ "func", "configureRuntime", "(", ")", "{", "if", "*", "flagPidFile", "!=", "\"", "\"", "{", "err", ":=", "ioutil", ".", "WriteFile", "(", "*", "flagPidFile", ",", "[", "]", "byte", "(", "strconv", ".", "Itoa", "(", "os", ".", "Getpid", "(", ")", ")...
// configureRuntime does various different settings that affect runtime // behavior or enables global functionality
[ "configureRuntime", "does", "various", "different", "settings", "that", "affect", "runtime", "behavior", "or", "enables", "global", "functionality" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/main.go#L208-L229
20,483
trivago/gollum
main.go
startMetricsService
func startMetricsService() func() { if *flagMetricsAddress == "" { return nil } address, err := parseAddress(*flagMetricsAddress) if err != nil { logrus.WithError(err).Error("Failed to parse metrics address") return nil } metricsType := "prometheus" if *flagMetricsType != "" { metricsType = strings.ToL...
go
func startMetricsService() func() { if *flagMetricsAddress == "" { return nil } address, err := parseAddress(*flagMetricsAddress) if err != nil { logrus.WithError(err).Error("Failed to parse metrics address") return nil } metricsType := "prometheus" if *flagMetricsType != "" { metricsType = strings.ToL...
[ "func", "startMetricsService", "(", ")", "func", "(", ")", "{", "if", "*", "flagMetricsAddress", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n\n", "address", ",", "err", ":=", "parseAddress", "(", "*", "flagMetricsAddress", ")", "\n", "if", "err...
// startMetricsService creates a metric endpoint if requested. // The returned function should be deferred if not nil.
[ "startMetricsService", "creates", "a", "metric", "endpoint", "if", "requested", ".", "The", "returned", "function", "should", "be", "deferred", "if", "not", "nil", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/main.go#L233-L257
20,484
trivago/gollum
main.go
startHealthCheckService
func startHealthCheckService() func() { if *flagHealthCheck == "" { return nil } address, err := parseAddress(*flagHealthCheck) if err != nil { logrus.WithError(err).Error("Failed to start health check service") return nil } thealthcheck.Configure(address) logrus.WithField("address", address).Info("Starti...
go
func startHealthCheckService() func() { if *flagHealthCheck == "" { return nil } address, err := parseAddress(*flagHealthCheck) if err != nil { logrus.WithError(err).Error("Failed to start health check service") return nil } thealthcheck.Configure(address) logrus.WithField("address", address).Info("Starti...
[ "func", "startHealthCheckService", "(", ")", "func", "(", ")", "{", "if", "*", "flagHealthCheck", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n", "address", ",", "err", ":=", "parseAddress", "(", "*", "flagHealthCheck", ")", "\n", "if", "err", ...
// startHealthCheckService creates a health check endpoint if requested. // The returned function should be deferred if not nil.
[ "startHealthCheckService", "creates", "a", "health", "check", "endpoint", "if", "requested", ".", "The", "returned", "function", "should", "be", "deferred", "if", "not", "nil", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/main.go#L261-L280
20,485
trivago/gollum
main.go
startMemoryProfiler
func startMemoryProfiler() func() { if *flagMemProfile == "" { return nil } return func() { file, err := os.Create(*flagMemProfile) if err != nil { logrus.WithError(err).Error("Failed to create memory profile results file") return } defer file.Close() logrus.WithField("file", *flagMemProfile).Inf...
go
func startMemoryProfiler() func() { if *flagMemProfile == "" { return nil } return func() { file, err := os.Create(*flagMemProfile) if err != nil { logrus.WithError(err).Error("Failed to create memory profile results file") return } defer file.Close() logrus.WithField("file", *flagMemProfile).Inf...
[ "func", "startMemoryProfiler", "(", ")", "func", "(", ")", "{", "if", "*", "flagMemProfile", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n\n", "return", "func", "(", ")", "{", "file", ",", "err", ":=", "os", ".", "Create", "(", "*", "flagM...
// startMemoryProfile enables the golang heap profiling process. // The returned function should be deferred if not nil.
[ "startMemoryProfile", "enables", "the", "golang", "heap", "profiling", "process", ".", "The", "returned", "function", "should", "be", "deferred", "if", "not", "nil", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/main.go#L312-L330
20,486
trivago/gollum
contrib/native/kafka/librdkafka/topicconfig.go
Set
func (c *TopicConfig) Set(key, value string) { nativeErr := new(ErrorHandle) if C.rd_kafka_topic_conf_set(c.handle, C.CString(key), C.CString(value), nativeErr.buffer(), nativeErr.len()) != 0 { Log.Print(nativeErr) } }
go
func (c *TopicConfig) Set(key, value string) { nativeErr := new(ErrorHandle) if C.rd_kafka_topic_conf_set(c.handle, C.CString(key), C.CString(value), nativeErr.buffer(), nativeErr.len()) != 0 { Log.Print(nativeErr) } }
[ "func", "(", "c", "*", "TopicConfig", ")", "Set", "(", "key", ",", "value", "string", ")", "{", "nativeErr", ":=", "new", "(", "ErrorHandle", ")", "\n", "if", "C", ".", "rd_kafka_topic_conf_set", "(", "c", ".", "handle", ",", "C", ".", "CString", "("...
// Set sets a string value in this config
[ "Set", "sets", "a", "string", "value", "in", "this", "config" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/contrib/native/kafka/librdkafka/topicconfig.go#L57-L62
20,487
trivago/gollum
contrib/native/kafka/librdkafka/topicconfig.go
SetI
func (c *TopicConfig) SetI(key string, value int) { nativeErr := new(ErrorHandle) strValue := strconv.Itoa(value) if C.rd_kafka_topic_conf_set(c.handle, C.CString(key), C.CString(strValue), nativeErr.buffer(), nativeErr.len()) != 0 { Log.Print(nativeErr) } }
go
func (c *TopicConfig) SetI(key string, value int) { nativeErr := new(ErrorHandle) strValue := strconv.Itoa(value) if C.rd_kafka_topic_conf_set(c.handle, C.CString(key), C.CString(strValue), nativeErr.buffer(), nativeErr.len()) != 0 { Log.Print(nativeErr) } }
[ "func", "(", "c", "*", "TopicConfig", ")", "SetI", "(", "key", "string", ",", "value", "int", ")", "{", "nativeErr", ":=", "new", "(", "ErrorHandle", ")", "\n", "strValue", ":=", "strconv", ".", "Itoa", "(", "value", ")", "\n", "if", "C", ".", "rd_...
// SetI sets an integer value in this config
[ "SetI", "sets", "an", "integer", "value", "in", "this", "config" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/contrib/native/kafka/librdkafka/topicconfig.go#L65-L71
20,488
trivago/gollum
core/simpleformatter.go
CanBeApplied
func (format *SimpleFormatter) CanBeApplied(msg *Message) bool { if format.SkipIfEmpty { return len(format.GetAppliedContent(msg)) > 0 } return true }
go
func (format *SimpleFormatter) CanBeApplied(msg *Message) bool { if format.SkipIfEmpty { return len(format.GetAppliedContent(msg)) > 0 } return true }
[ "func", "(", "format", "*", "SimpleFormatter", ")", "CanBeApplied", "(", "msg", "*", "Message", ")", "bool", "{", "if", "format", ".", "SkipIfEmpty", "{", "return", "len", "(", "format", ".", "GetAppliedContent", "(", "msg", ")", ")", ">", "0", "\n", "...
// CanBeApplied returns true if the formatter can be applied to this message
[ "CanBeApplied", "returns", "true", "if", "the", "formatter", "can", "be", "applied", "to", "this", "message" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/simpleformatter.go#L53-L58
20,489
trivago/gollum
core/pluginconfigreader.go
NewPluginConfigReader
func NewPluginConfigReader(config *PluginConfig) PluginConfigReader { errors := tgo.NewErrorStack() errors.SetFormat(tgo.ErrorStackFormatCSV) return PluginConfigReader{ WithError: NewPluginConfigReaderWithError(config), Errors: &errors, } }
go
func NewPluginConfigReader(config *PluginConfig) PluginConfigReader { errors := tgo.NewErrorStack() errors.SetFormat(tgo.ErrorStackFormatCSV) return PluginConfigReader{ WithError: NewPluginConfigReaderWithError(config), Errors: &errors, } }
[ "func", "NewPluginConfigReader", "(", "config", "*", "PluginConfig", ")", "PluginConfigReader", "{", "errors", ":=", "tgo", ".", "NewErrorStack", "(", ")", "\n", "errors", ".", "SetFormat", "(", "tgo", ".", "ErrorStackFormatCSV", ")", "\n", "return", "PluginConf...
// NewPluginConfigReader creates a new reader on top of a given config.
[ "NewPluginConfigReader", "creates", "a", "new", "reader", "on", "top", "of", "a", "given", "config", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/pluginconfigreader.go#L51-L58
20,490
trivago/gollum
core/pluginconfigreader.go
NewPluginConfigReaderFromReader
func NewPluginConfigReaderFromReader(reader PluginConfigReaderWithError) PluginConfigReader { errors := tgo.NewErrorStack() errors.SetFormat(tgo.ErrorStackFormatCSV) return PluginConfigReader{ WithError: reader, Errors: &errors, } }
go
func NewPluginConfigReaderFromReader(reader PluginConfigReaderWithError) PluginConfigReader { errors := tgo.NewErrorStack() errors.SetFormat(tgo.ErrorStackFormatCSV) return PluginConfigReader{ WithError: reader, Errors: &errors, } }
[ "func", "NewPluginConfigReaderFromReader", "(", "reader", "PluginConfigReaderWithError", ")", "PluginConfigReader", "{", "errors", ":=", "tgo", ".", "NewErrorStack", "(", ")", "\n", "errors", ".", "SetFormat", "(", "tgo", ".", "ErrorStackFormatCSV", ")", "\n", "retu...
// NewPluginConfigReaderFromReader encapsulates a WithError reader that // is already attached to a config to read from.
[ "NewPluginConfigReaderFromReader", "encapsulates", "a", "WithError", "reader", "that", "is", "already", "attached", "to", "a", "config", "to", "read", "from", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/pluginconfigreader.go#L62-L69
20,491
trivago/gollum
core/pluginconfigreader.go
GetModulatorArray
func (reader *PluginConfigReader) GetModulatorArray(key string, logger logrus.FieldLogger, defaultValue ModulatorArray) ModulatorArray { modulators, err := reader.WithError.GetModulatorArray(key, logger, defaultValue) reader.Errors.Push(err) return modulators }
go
func (reader *PluginConfigReader) GetModulatorArray(key string, logger logrus.FieldLogger, defaultValue ModulatorArray) ModulatorArray { modulators, err := reader.WithError.GetModulatorArray(key, logger, defaultValue) reader.Errors.Push(err) return modulators }
[ "func", "(", "reader", "*", "PluginConfigReader", ")", "GetModulatorArray", "(", "key", "string", ",", "logger", "logrus", ".", "FieldLogger", ",", "defaultValue", "ModulatorArray", ")", "ModulatorArray", "{", "modulators", ",", "err", ":=", "reader", ".", "With...
// GetModulatorArray reads an array of modulator plugins
[ "GetModulatorArray", "reads", "an", "array", "of", "modulator", "plugins" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/pluginconfigreader.go#L189-L193
20,492
trivago/gollum
core/pluginconfigreader.go
Configure
func (reader *PluginConfigReader) Configure(item interface{}) error { itemValue := reflect.ValueOf(item) if itemValue.Kind() != reflect.Ptr { panic("Configure requires reference") } var logger logrus.FieldLogger if loggable, isScoped := item.(ScopedLogger); isScoped { logger = loggable.GetLogger() } reader...
go
func (reader *PluginConfigReader) Configure(item interface{}) error { itemValue := reflect.ValueOf(item) if itemValue.Kind() != reflect.Ptr { panic("Configure requires reference") } var logger logrus.FieldLogger if loggable, isScoped := item.(ScopedLogger); isScoped { logger = loggable.GetLogger() } reader...
[ "func", "(", "reader", "*", "PluginConfigReader", ")", "Configure", "(", "item", "interface", "{", "}", ")", "error", "{", "itemValue", ":=", "reflect", ".", "ValueOf", "(", "item", ")", "\n", "if", "itemValue", ".", "Kind", "(", ")", "!=", "reflect", ...
// Configure will configure a given item by scanning for plugin struct tags and // calling the Configure method. Nested types will be traversed automatically.
[ "Configure", "will", "configure", "a", "given", "item", "by", "scanning", "for", "plugin", "struct", "tags", "and", "calling", "the", "Configure", "method", ".", "Nested", "types", "will", "be", "traversed", "automatically", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/pluginconfigreader.go#L253-L270
20,493
trivago/gollum
core/formattermodulator.go
Modulate
func (formatterModulator *FormatterModulator) Modulate(msg *Message) ModulateResult { err := formatterModulator.ApplyFormatter(msg) if err != nil { logrus.Warning("FormatterModulator with error:", err) return ModulateResultDiscard } return ModulateResultContinue }
go
func (formatterModulator *FormatterModulator) Modulate(msg *Message) ModulateResult { err := formatterModulator.ApplyFormatter(msg) if err != nil { logrus.Warning("FormatterModulator with error:", err) return ModulateResultDiscard } return ModulateResultContinue }
[ "func", "(", "formatterModulator", "*", "FormatterModulator", ")", "Modulate", "(", "msg", "*", "Message", ")", "ModulateResult", "{", "err", ":=", "formatterModulator", ".", "ApplyFormatter", "(", "msg", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", "...
// Modulate implementation for Formatter
[ "Modulate", "implementation", "for", "Formatter" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/formattermodulator.go#L34-L42
20,494
trivago/gollum
core/formattermodulator.go
CanBeApplied
func (formatterModulator *FormatterModulator) CanBeApplied(msg *Message) bool { return formatterModulator.Formatter.CanBeApplied(msg) }
go
func (formatterModulator *FormatterModulator) CanBeApplied(msg *Message) bool { return formatterModulator.Formatter.CanBeApplied(msg) }
[ "func", "(", "formatterModulator", "*", "FormatterModulator", ")", "CanBeApplied", "(", "msg", "*", "Message", ")", "bool", "{", "return", "formatterModulator", ".", "Formatter", ".", "CanBeApplied", "(", "msg", ")", "\n", "}" ]
// CanBeApplied returns true if the array is not empty
[ "CanBeApplied", "returns", "true", "if", "the", "array", "is", "not", "empty" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/formattermodulator.go#L45-L47
20,495
trivago/gollum
core/formattermodulator.go
ApplyFormatter
func (formatterModulator *FormatterModulator) ApplyFormatter(msg *Message) error { if formatterModulator.CanBeApplied(msg) { return formatterModulator.Formatter.ApplyFormatter(msg) } return nil }
go
func (formatterModulator *FormatterModulator) ApplyFormatter(msg *Message) error { if formatterModulator.CanBeApplied(msg) { return formatterModulator.Formatter.ApplyFormatter(msg) } return nil }
[ "func", "(", "formatterModulator", "*", "FormatterModulator", ")", "ApplyFormatter", "(", "msg", "*", "Message", ")", "error", "{", "if", "formatterModulator", ".", "CanBeApplied", "(", "msg", ")", "{", "return", "formatterModulator", ".", "Formatter", ".", "App...
// ApplyFormatter calls the Formatter.ApplyFormatter method
[ "ApplyFormatter", "calls", "the", "Formatter", ".", "ApplyFormatter", "method" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/formattermodulator.go#L50-L55
20,496
trivago/gollum
core/plugin.go
NewPluginRunState
func NewPluginRunState() *PluginRunState { stateToMetric[PluginStateInitializing].Inc(1) return &PluginRunState{ workers: nil, state: int32(PluginStateInitializing), } }
go
func NewPluginRunState() *PluginRunState { stateToMetric[PluginStateInitializing].Inc(1) return &PluginRunState{ workers: nil, state: int32(PluginStateInitializing), } }
[ "func", "NewPluginRunState", "(", ")", "*", "PluginRunState", "{", "stateToMetric", "[", "PluginStateInitializing", "]", ".", "Inc", "(", "1", ")", "\n", "return", "&", "PluginRunState", "{", "workers", ":", "nil", ",", "state", ":", "int32", "(", "PluginSta...
// NewPluginRunState creates a new plugin state helper
[ "NewPluginRunState", "creates", "a", "new", "plugin", "state", "helper" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/plugin.go#L111-L117
20,497
trivago/gollum
core/plugin.go
SetState
func (state *PluginRunState) SetState(nextState PluginState) { prevState := PluginState(atomic.SwapInt32(&state.state, int32(nextState))) if nextState != prevState { stateToMetric[prevState].Dec(1) stateToMetric[nextState].Inc(1) } }
go
func (state *PluginRunState) SetState(nextState PluginState) { prevState := PluginState(atomic.SwapInt32(&state.state, int32(nextState))) if nextState != prevState { stateToMetric[prevState].Dec(1) stateToMetric[nextState].Inc(1) } }
[ "func", "(", "state", "*", "PluginRunState", ")", "SetState", "(", "nextState", "PluginState", ")", "{", "prevState", ":=", "PluginState", "(", "atomic", ".", "SwapInt32", "(", "&", "state", ".", "state", ",", "int32", "(", "nextState", ")", ")", ")", "\...
// SetState sets a new plugin state casted to the correct type
[ "SetState", "sets", "a", "new", "plugin", "state", "casted", "to", "the", "correct", "type" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/plugin.go#L130-L137
20,498
trivago/gollum
core/plugin.go
NewPluginWithConfig
func NewPluginWithConfig(config PluginConfig) (Plugin, error) { if len(config.Typename) == 0 { return nil, fmt.Errorf("plugin '%s' has no type set", config.ID) } obj, err := TypeRegistry.New(config.Typename) if err != nil { return nil, err } plugin, isPlugin := obj.(Plugin) if !isPlugin { return nil, fmt...
go
func NewPluginWithConfig(config PluginConfig) (Plugin, error) { if len(config.Typename) == 0 { return nil, fmt.Errorf("plugin '%s' has no type set", config.ID) } obj, err := TypeRegistry.New(config.Typename) if err != nil { return nil, err } plugin, isPlugin := obj.(Plugin) if !isPlugin { return nil, fmt...
[ "func", "NewPluginWithConfig", "(", "config", "PluginConfig", ")", "(", "Plugin", ",", "error", ")", "{", "if", "len", "(", "config", ".", "Typename", ")", "==", "0", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "config", "....
// NewPluginWithConfig creates a new plugin from the type information stored in its // config. This function internally calls NewPluginWithType.
[ "NewPluginWithConfig", "creates", "a", "new", "plugin", "from", "the", "type", "information", "stored", "in", "its", "config", ".", "This", "function", "internally", "calls", "NewPluginWithType", "." ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/plugin.go#L159-L191
20,499
trivago/gollum
core/writerassembly.go
NewWriterAssembly
func NewWriterAssembly(writer io.Writer, flush func(*Message), modulator Modulator) WriterAssembly { return WriterAssembly{ writer: writer, modulator: modulator, flush: flush, writerGuard: new(sync.Mutex), } }
go
func NewWriterAssembly(writer io.Writer, flush func(*Message), modulator Modulator) WriterAssembly { return WriterAssembly{ writer: writer, modulator: modulator, flush: flush, writerGuard: new(sync.Mutex), } }
[ "func", "NewWriterAssembly", "(", "writer", "io", ".", "Writer", ",", "flush", "func", "(", "*", "Message", ")", ",", "modulator", "Modulator", ")", "WriterAssembly", "{", "return", "WriterAssembly", "{", "writer", ":", "writer", ",", "modulator", ":", "modu...
// NewWriterAssembly creates a new adapter between io.Writer and the MessageBatch // AssemblyFunc function signature
[ "NewWriterAssembly", "creates", "a", "new", "adapter", "between", "io", ".", "Writer", "and", "the", "MessageBatch", "AssemblyFunc", "function", "signature" ]
de2faa584cd526bb852e8a4b693982ba4216757f
https://github.com/trivago/gollum/blob/de2faa584cd526bb852e8a4b693982ba4216757f/core/writerassembly.go#L37-L44