d48fb81193
Implement a component for transmitting the value of the used container space along a route defined in the system. Implement WriterProvider interface on it. By implementation, it is the link between the route planner and the point-to-point transmitter, and abstracts from the implementation of both of them. In the future, this implementation will be used as a transmitter of local estimates of storage nodes among themselves. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
28 lines
459 B
Go
28 lines
459 B
Go
package loadroute
|
|
|
|
import (
|
|
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
// Option sets an optional parameter of Router.
|
|
type Option func(*options)
|
|
|
|
type options struct {
|
|
log *logger.Logger
|
|
}
|
|
|
|
func defaultOpts() *options {
|
|
return &options{
|
|
log: zap.L(),
|
|
}
|
|
}
|
|
|
|
// WithLogger returns Option to specify logging component.
|
|
func WithLogger(l *logger.Logger) Option {
|
|
return func(o *options) {
|
|
if l != nil {
|
|
o.log = l
|
|
}
|
|
}
|
|
}
|