func NewSqlQuery(config Config) *SqlQuery { sq := &SqlQuery{} sq.qe = NewQueryEngine(config) stats.PublishJSONFunc("Voltron", sq.statsJSON) stats.Publish("TabletState", stats.IntFunc(sq.state.Get)) stats.Publish("TabletStateName", stats.StringFunc(sq.GetState)) return sq }
func NewSqlQuery(config Config) *SqlQuery { sq := &SqlQuery{} sq.qe = NewQueryEngine(config) sq.states = stats.NewStates("", []string{ stateName[NOT_SERVING], stateName[CONNECTING], stateName[ABORT], stateName[INITIALIZING], stateName[SERVING], stateName[SHUTTING_DOWN], }, time.Now(), NOT_SERVING) stats.PublishJSONFunc("Voltron", sq.statsJSON) stats.Publish("TabletState", stats.IntFunc(sq.state.Get)) return sq }
func NewZkReader(resolveLocal bool, preload []string) *ZkReader { zkr := &ZkReader{zcell: make(map[string]*zkCell), resolveLocal: resolveLocal} if resolveLocal { zkr.localCell = zk.GuessLocalCell() } zkr.rpcCalls = stats.NewInt("ZkReaderRpcCalls") zkr.unknownCellErrors = stats.NewInt("ZkReaderUnknownCellErrors") zkr.zkrStats = newZkrStats() stats.PublishJSONFunc("ZkReader", zkr.statsJSON) // start some cells for _, cellName := range preload { _, path, err := zkr.getCell("/zk/" + cellName) if err != nil { log.Errorf("Cell " + cellName + " could not be preloaded: " + err.Error()) } else { log.Infof("Cell " + cellName + " preloaded for: " + path) } } return zkr }
func init() { zconn := zk.NewMetaConn() stats.PublishJSONFunc("ZkMetaConn", zconn.String) topo.RegisterServer("zookeeper", &Server{zconn: zconn}) }
func init() { zconn := zk.NewMetaConn(false) stats.PublishJSONFunc("ZkMetaConn", zconn.String) topo.RegisterServer("zookeeper", NewServer(zconn)) }