micro/util/pool/options.go

39 lines
572 B
Go
Raw Normal View History

2019-07-28 20:56:18 +03:00
package pool
import (
"time"
"go.unistack.org/micro/v3/network/transport"
2019-07-28 20:56:18 +03:00
)
// Options struct
2019-07-28 20:56:18 +03:00
type Options struct {
Transport transport.Transport
TTL time.Duration
Size int
}
// Option func signature
2019-07-28 20:56:18 +03:00
type Option func(*Options)
// Size sets the size
2019-07-28 20:56:18 +03:00
func Size(i int) Option {
return func(o *Options) {
o.Size = i
}
}
// Transport sets the transport
2019-07-28 20:56:18 +03:00
func Transport(t transport.Transport) Option {
return func(o *Options) {
o.Transport = t
}
}
// TTL specifies ttl
2019-07-28 20:56:18 +03:00
func TTL(t time.Duration) Option {
return func(o *Options) {
o.TTL = t
}
}