func NewManager(logger *pct.Logger, configDir string, api pct.APIConnector) *Manager { repo := NewRepo(pct.NewLogger(logger.LogChan(), "instance-repo"), configDir, api) m := &Manager{ logger: logger, configDir: configDir, // -- status: pct.NewStatus([]string{"instance", "instance-repo"}), repo: repo, } return m }
func NewManager(logger *pct.Logger, configDir string, api pct.APIConnector, mrm mrms.Monitor) *Manager { repo := NewRepo(pct.NewLogger(logger.LogChan(), "instance-repo"), configDir, api) m := &Manager{ logger: logger, configDir: configDir, api: api, // -- status: pct.NewStatus([]string{"instance", "instance-repo", "instance-mrms"}), repo: repo, mrm: mrm, mrmChans: make(map[string]<-chan bool), mrmsGlobalChan: make(chan string, 100), // monitor up to 100 instances } return m }
func NewWebsocketClient(logger *pct.Logger, api pct.APIConnector, link string) (*WebsocketClient, error) { name := logger.Service() c := &WebsocketClient{ logger: logger, api: api, link: link, // -- conn: nil, recvChan: make(chan *proto.Cmd, RECV_BUFFER_SIZE), sendChan: make(chan *proto.Reply, SEND_BUFFER_SIZE), connectChan: make(chan bool, 1), errChan: make(chan error, 2), backoff: pct.NewBackoff(5 * time.Minute), sendSync: pct.NewSyncChan(), recvSync: pct.NewSyncChan(), mux: new(sync.Mutex), name: name, status: pct.NewStatus([]string{name, name + "-link"}), } return c, nil }
func NewRealAnalyzer(logger *pct.Logger, config Config, iter IntervalIter, mysqlConn mysql.Connector, restartChan <-chan bool, worker Worker, clock ticker.Manager, spool data.Spooler) *RealAnalyzer { name := logger.Service() a := &RealAnalyzer{ logger: logger, config: config, iter: iter, mysqlConn: mysqlConn, restartChan: restartChan, worker: worker, clock: clock, spool: spool, // -- name: name, mysqlConfiguredChan: make(chan bool, 1), workerDoneChan: make(chan *Interval, 1), status: pct.NewStatus([]string{name, name + "-last-interval", name + "-next-interval"}), runSync: pct.NewSyncChan(), configureMySQLSync: pct.NewSyncChan(), mux: &sync.RWMutex{}, } return a }