func (s *listenerSuite) SetUpTest(c *gc.C) { s.handler = &mockHandler{} s.socketPath = sockPath(c) listener, err := spool.NewSocketListener(s.socketPath, s.handler) c.Assert(err, jc.ErrorIsNil) s.listener = listener }
func newSender(client metricsadder.MetricsAdderClient, factory spool.MetricFactory, baseDir, unitTag string) (*sender, error) { s := &sender{ client: client, factory: factory, } listener, err := spool.NewSocketListener(socketName(baseDir, unitTag), s) if err != nil { return nil, errors.Trace(err) } s.listener = listener return s, nil }
// newRecorder returns a struct that implements the spool.MetricRecorder // interface. newRecorder = func(unitTag names.UnitTag, paths context.Paths, metricFactory spool.MetricFactory) (spool.MetricRecorder, error) { chURL, charmMetrics, err := readCharm(unitTag, paths) if err != nil { return nil, errors.Trace(err) } if len(charmMetrics) == 0 { return nil, errMetricsNotDefined } return metricFactory.Recorder(charmMetrics, chURL.String(), unitTag.String()) } newSocketListener = func(path string, handler spool.ConnectionHandler) (stopper, error) { return spool.NewSocketListener(path, handler) } ) type stopper interface { Stop() } // ManifoldConfig identifies the resource names upon which the collect manifold // depends. type ManifoldConfig struct { Period *time.Duration AgentName string MetricSpoolName string CharmDirName string