Monitor: address comments

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
This commit is contained in:
Hector Sanjuan 2018-05-08 13:10:38 +02:00
parent 6159a7f15a
commit e4844ca819
5 changed files with 10 additions and 10 deletions

View File

@ -558,7 +558,7 @@ func (c *Cluster) PeerAdd(addr ma.Multiaddr) (api.ID, error) {
}
ctxs, cancels := rpcutil.CtxsWithCancel(c.ctx, len(peers))
defer rpcutil.Multicancel(cancels)
defer rpcutil.MultiCancel(cancels)
errs := c.rpcClient.MultiCall(
ctxs,
@ -1002,7 +1002,7 @@ func (c *Cluster) Peers() []api.ID {
peers := make([]api.ID, len(members), len(members))
ctxs, cancels := rpcutil.CtxsWithCancel(c.ctx, len(members))
defer rpcutil.Multicancel(cancels)
defer rpcutil.MultiCancel(cancels)
errs := c.rpcClient.MultiCall(
ctxs,
@ -1044,7 +1044,7 @@ func (c *Cluster) globalPinInfoCid(method string, h *cid.Cid) (api.GlobalPinInfo
}
ctxs, cancels := rpcutil.CtxsWithCancel(c.ctx, len(members))
defer rpcutil.Multicancel(cancels)
defer rpcutil.MultiCancel(cancels)
errs := c.rpcClient.MultiCall(
ctxs,
@ -1105,7 +1105,7 @@ func (c *Cluster) globalPinInfoSlice(method string) ([]api.GlobalPinInfo, error)
replies := make([][]api.PinInfoSerial, len(members), len(members))
ctxs, cancels := rpcutil.CtxsWithCancel(c.ctx, len(members))
defer rpcutil.Multicancel(cancels)
defer rpcutil.MultiCancel(cancels)
errs := c.rpcClient.MultiCall(
ctxs,

View File

@ -23,7 +23,7 @@ func (c *Cluster) ConnectGraph() (api.ConnectGraph, error) {
peersSerials := make([][]api.IDSerial, len(members), len(members))
ctxs, cancels := rpcutil.CtxsWithCancel(c.ctx, len(members))
defer rpcutil.Multicancel(cancels)
defer rpcutil.MultiCancel(cancels)
errs := c.rpcClient.MultiCall(
ctxs,

View File

@ -152,12 +152,12 @@ type PinAllocator interface {
Allocate(c *cid.Cid, current, candidates, priority map[peer.ID]api.Metric) ([]peer.ID, error)
}
// PeerMonitor is a component in charge of publishing peers metrics and
// PeerMonitor is a component in charge of publishing a peer's metrics and
// reading metrics from other peers in the cluster. The PinAllocator will
// use the metrics provided by the monitor as candidates for Pin allocations.
//
// The PeerMonitor component also provides an Alert channel which is signaled
// when a metric is no longer received and the monitor judges identifies it
// when a metric is no longer received and the monitor identifies it
// as a problem.
type PeerMonitor interface {
Component

View File

@ -118,7 +118,7 @@ func (mon *Monitor) PublishMetric(m api.Metric) error {
}
ctxs, cancels := rpcutil.CtxsWithTimeout(mon.ctx, len(peers), m.GetTTL()/2)
defer rpcutil.Multicancel(cancels)
defer rpcutil.MultiCancel(cancels)
logger.Debugf(
"broadcasting metric %s to %s. Expires: %d",

View File

@ -45,9 +45,9 @@ func CtxsWithCancel(
return ctxs, cancels
}
// Multicancel calls all the provided CancelFuncs. It
// MultiCancel calls all the provided CancelFuncs. It
// is useful with "defer Multicancel()"
func Multicancel(cancels []context.CancelFunc) {
func MultiCancel(cancels []context.CancelFunc) {
for _, cancel := range cancels {
cancel()
}