mirror of
https://github.com/AynaLivePlayer/AynaLivePlayer.git
synced 2026-03-15 14:03:17 +08:00
30 lines
495 B
Go
30 lines
495 B
Go
package eventbus
|
|
|
|
type options struct {
|
|
log Logger
|
|
maxWorkerSize int
|
|
queueSize int
|
|
}
|
|
|
|
type Option func(*options)
|
|
|
|
func WithLogger(logger Logger) Option {
|
|
return func(o *options) { o.log = logger }
|
|
}
|
|
|
|
func WithMaxWorkerSize(maxWorkerSize int) Option {
|
|
return func(o *options) {
|
|
if maxWorkerSize >= 1 {
|
|
o.maxWorkerSize = maxWorkerSize
|
|
}
|
|
}
|
|
}
|
|
|
|
func WithQueueSize(queueSize int) Option {
|
|
return func(o *options) {
|
|
if queueSize >= 1 {
|
|
o.queueSize = queueSize
|
|
}
|
|
}
|
|
}
|