mirror of
https://github.com/AynaLivePlayer/AynaLivePlayer.git
synced 2026-03-27 06:09:46 +08:00
30 lines
471 B
Go
30 lines
471 B
Go
package eventbus
|
|
|
|
type options struct {
|
|
log Logger
|
|
workerSize int
|
|
queueSize int
|
|
}
|
|
|
|
type Option func(*options)
|
|
|
|
func WithLogger(logger Logger) Option {
|
|
return func(o *options) { o.log = logger }
|
|
}
|
|
|
|
func WithWorkerSize(workerSize int) Option {
|
|
return func(o *options) {
|
|
if workerSize >= 1 {
|
|
o.workerSize = workerSize
|
|
}
|
|
}
|
|
}
|
|
|
|
func WithQueueSize(queueSize int) Option {
|
|
return func(o *options) {
|
|
if queueSize >= 1 {
|
|
o.queueSize = queueSize
|
|
}
|
|
}
|
|
}
|