Beispiel #1
0
		void check_class(uint16_t id, string name, unsigned long hash)
		{
			DCClass* dcc = g_dcf->get_class(id);
			if(name != dcc->get_name())
			{
				// TODO: Try and update the database instead of exiting
				m_log->fatal() << "Class name '" << dcc->get_name() << "' from DCFile does not match"
				               " name '" << name << "' in database, for dc_id " << id << endl;
				m_log->fatal() << "Database must be rebuilt." << endl;
				exit(1);
			}

			HashGenerator gen;
			dcc->generate_hash(gen);
			if(hash != gen.get_hash())
			{
				// TODO: Try and update the database instead of exiting
				m_log->fatal() << "Class hash '" << gen.get_hash() << "' from DCFile does not match"
				               " hash '" << hash << "' in database, for dc_id " << id << endl;
				m_log->fatal() << "Database must be rebuilt." << endl;
				exit(1);
			}

			// TODO: Check class_fields table exists

		}
Beispiel #2
0
    void check_class(uint16_t id, string name)
    {
        const Class* dcc = g_dcf->get_class_by_id(id);
        if(name != dcc->get_name()) {
            // TODO: Try and update the database instead of exiting
            m_log->fatal() << "Class name '" << dcc->get_name() << "' from File does not match"
                           " name '" << name << "' in database, for dc_id " << id << endl;
            m_log->fatal() << "Database must be rebuilt." << endl;
            astron_shutdown(1);
        }

        // TODO: Check class_fields table exists

    }
Beispiel #3
0
		DatabaseServer(RoleConfig roleconfig) : Role(roleconfig),
			m_db_engine(DBEngineFactory::singleton.instantiate(
							engine_type.get_rval(roleconfig),
							roleconfig["engine"],
							min_id.get_rval(roleconfig),
							max_id.get_rval(roleconfig))),
			m_control_channel(control_channel.get_rval(roleconfig)),
			m_min_id(min_id.get_rval(roleconfig)),
			m_max_id(max_id.get_rval(roleconfig))
		{
			// Initialize DatabaseServer log
			std::stringstream log_title;
			log_title << "Database(" << m_control_channel << ")";
			m_log = new LogCategory("db", log_title.str());

			// Check to see the engine was instantiated
			if(!m_db_engine)
			{
				m_log->fatal() << "No database engine of type '" << engine_type.get_rval(roleconfig) << "' exists." << std::endl;
				exit(1);
			}

			// Listen on control channel
			subscribe_channel(m_control_channel);
		}
Beispiel #4
0
    DBClientBase *new_connection()
    {
        string error;
        DBClientBase *connection;

        if(!(connection = m_connection_string.connect(error))) {
            m_log->fatal() << "Connection failure: " << error << endl;
            exit(1);
        }

        return connection;
    }
Beispiel #5
0
void ConfigGroup::add_variable(const string& varname, rtest r)
{
	bool inserted = m_variables.insert(pair<string,rtest>(varname, r)).second;
	if(!inserted)
	{
		config_log.fatal() << "Duplicate ConfigVariable name (" << varname << ") in ConfigGroup '"
		                   << m_name << ".'\n\tPlease submit a bug/issue to Astron with your"
		                   << " CMakeCache and this ouput.\n";
		exit(1);
		// TODO: Produce a warning for the developer or something...
	}
}