func RegisterCacheInvalidator() {
	if CacheInvalidationProcessor != nil {
		return
	}
	CacheInvalidationProcessor = NewInvalidationProcessor()
	CacheInvalidationProcessor.states = estats.NewStates("", []string{
		"Disabled",
		"Enabled",
	}, time.Now(), DISABLED)
	expvar.Publish("CacheInvalidationProcessor", estats.StrFunc(func() string { return CacheInvalidationProcessor.statsJSON() }))
}
Exemple #2
0
func RegisterUpdateStreamService(mycnf *Mycnf) {
	if UpdateStreamRpcService != nil {
		//relog.Warning("Update Stream service already initialized")
		return
	}

	UpdateStreamRpcService = &UpdateStream{mycnf: mycnf}
	UpdateStreamRpcService.states = estats.NewStates("", []string{
		"Disabled",
		"Enabled",
	}, time.Now(), DISABLED)
	rpcwrap.RegisterAuthenticated(UpdateStreamRpcService)
	expvar.Publish("UpdateStreamRpcService", estats.StrFunc(func() string { return UpdateStreamRpcService.statsJSON() }))
}
Exemple #3
0
func NewSqlQuery(config Config) *SqlQuery {
	sq := &SqlQuery{}
	sq.qe = NewQueryEngine(config)
	sq.states = stats.NewStates("", []string{
		stateName[NOT_SERVING],
		stateName[CLOSED],
		stateName[CONNECTING],
		stateName[ABORT],
		stateName[INITIALIZING],
		stateName[OPEN],
		stateName[SHUTTING_DOWN],
	}, time.Now(), NOT_SERVING)
	expvar.Publish("Voltron", stats.StrFunc(func() string { return sq.statsJSON() }))
	return sq
}
Exemple #4
0
func NewZkReader(resolveLocal bool, preload []string) *ZkReader {
	zkr := &ZkReader{zcell: make(map[string]*zkCell), resolveLocal: resolveLocal}
	if resolveLocal {
		zkr.localCell = zk.GuessLocalCell()
	}

	// register to expvar
	expvar.Publish("ZkReader", stats.StrFunc(func() string { return zkr.statsJSON() }))

	// start some cells
	for _, cellName := range preload {
		_, path, err := zkr.getCell("/zk/" + cellName)
		if err != nil {
			relog.Error("Cell " + cellName + " could not be preloaded: " + err.Error())
		} else {
			relog.Info("Cell " + cellName + " preloaded for: " + path)
		}
	}
	return zkr
}