// OpenTopology returns the DB instance for the orchestrator backed database func OpenOrchestrator() (*sql.DB, error) { mysql_uri := fmt.Sprintf("%s:%s@tcp(%s:%d)/%s", config.Config.MySQLOrchestratorUser, config.Config.MySQLOrchestratorPassword, config.Config.MySQLOrchestratorHost, config.Config.MySQLOrchestratorPort, config.Config.MySQLOrchestratorDatabase) db, fromCache, err := sqlutils.GetDB(mysql_uri) if err == nil && !fromCache { initOrchestratorDB(db) } return db, err }
// OpenTopology returns a DB instance to access a topology instance func OpenTopology(host string, port int) (*sql.DB, error) { mysql_uri := fmt.Sprintf("%s:%s@tcp(%s:%d)/", config.Config.MySQLTopologyUser, config.Config.MySQLTopologyPassword, host, port) db, _, err := sqlutils.GetDB(mysql_uri) return db, err }