mirror of
https://github.com/fluencelabs/tendermint
synced 2025-07-31 04:01:55 +00:00
fixes after @xla review
- move prometheus metrics into internal packages - *Option structs - misc. format changes
This commit is contained in:
@@ -77,8 +77,11 @@ type Switch struct {
|
||||
metrics *Metrics
|
||||
}
|
||||
|
||||
// SwitchOption sets an optional parameter on the Switch.
|
||||
type SwitchOption func(*Switch)
|
||||
|
||||
// NewSwitch creates a new Switch with the given config.
|
||||
func NewSwitch(cfg *config.P2PConfig, options ...func(*Switch)) *Switch {
|
||||
func NewSwitch(cfg *config.P2PConfig, options ...SwitchOption) *Switch {
|
||||
sw := &Switch{
|
||||
config: cfg,
|
||||
reactors: make(map[string]Reactor),
|
||||
@@ -111,10 +114,8 @@ func NewSwitch(cfg *config.P2PConfig, options ...func(*Switch)) *Switch {
|
||||
}
|
||||
|
||||
// WithMetrics sets the metrics.
|
||||
func WithMetrics(metrics *Metrics) func(*Switch) {
|
||||
return func(sw *Switch) {
|
||||
sw.metrics = metrics
|
||||
}
|
||||
func WithMetrics(metrics *Metrics) SwitchOption {
|
||||
return func(sw *Switch) { sw.metrics = metrics }
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user