From 86fc61db75385d6fb452b4cf88aec1deffa3a5be Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 23 Nov 2010 15:51:54 +0100 Subject: remove sqlite DB This change removes sqlite database. Database was used to find dump dirs by [UID:]UUID. This patch uses more natural way: dump dirs are addressed by their directory names. DB was also used to produce a list of dump dirs. Now it is done by iterating over the /var/spool/abrt directory. And finally, DB was also used to find duplicate UUIDs. Now it is done by iterating over the /var/spool/abrt directory. Crash count, "inform all" and reporting result message are moved from DB field to a file in dump dir. "Reported" DB field is deleted - if message != "", then this dump was reported. Signed-off-by: Denys Vlasenko --- src/include/Makefile.am | 1 - src/include/crash_types.h | 24 ++++----- src/include/database.h | 134 ---------------------------------------------- 3 files changed, 9 insertions(+), 150 deletions(-) delete mode 100644 src/include/database.h (limited to 'src/include') diff --git a/src/include/Makefile.am b/src/include/Makefile.am index 4d2ea810..11f3e461 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am @@ -8,7 +8,6 @@ HEADER_FILES = \ dump_dir.h \ observer.h \ plugin.h \ - database.h \ action.h \ analyzer.h \ xfuncs.h diff --git a/src/include/crash_types.h b/src/include/crash_types.h index 5c57e09e..28b2eb09 100644 --- a/src/include/crash_types.h +++ b/src/include/crash_types.h @@ -37,7 +37,7 @@ // Name of the function where the application crashed. // Optional. #define FILENAME_CRASH_FUNCTION "crash_function" -// filled by CDebugDump::Create() (which also fills CD_UID): +// filled by CDebugDump::Create() (which also fills FILENAME_UID): #define FILENAME_ARCHITECTURE "architecture" #define FILENAME_KERNEL "kernel" #define FILENAME_TIME "time" @@ -55,22 +55,16 @@ #define FILENAME_TAINTED "kernel_tainted" // TODO: TicketUploader also has open-coded "TICKET", "CUSTOMER" files -// Apart from CD_UID, which is also stored as a file in dump directory, -// these items only exist in db. (CD_UID is also a file because -// dump directory is created before its DB entry, and DB has to learn -// CD_UID from _somewhere_ in order to be able to store it in DB record, -// right?) -#define CD_UID "uid" -// Now uuid also is saved as a file (but is still stored in database too): -#define CD_UUID "uuid" -#define CD_INFORMALL "InformAll" -#define CD_DUMPDIR "DumpDir" -#define CD_COUNT "Count" -#define CD_REPORTED "Reported" -#define CD_MESSAGE "Message" +#define FILENAME_UID "uid" +#define FILENAME_UUID "uuid" +#define FILENAME_INFORMALL "inform_all_users" +#define FILENAME_COUNT "count" +#define FILENAME_MESSAGE "message" +// Not stored as files, added "on the fly": +#define CD_DUMPDIR "DumpDir" // "Which events are possible (make sense) on this crash dump?" // (a string with "\n" terminated event names) -#define CD_EVENTS "Events" +#define CD_EVENTS "Events" // Crash data is a map of 3-element vectors of strings: type, editable, content diff --git a/src/include/database.h b/src/include/database.h deleted file mode 100644 index 5eaceed7..00000000 --- a/src/include/database.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - Database.h - header file for database plugin - - Copyright (C) 2009 Zdenek Prikryl (zprikryl@redhat.com) - Copyright (C) 2009 RedHat inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ -#ifndef DATABASE_H_ -#define DATABASE_H_ - -#include - -/** - * Table - * ===== - * UUID | UID| DebugDumpPath | Count | Reported | Time | Message - * - * primary key (UUID, UID) - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * A struct contains one database row. - */ -struct db_row -{ - char *db_uuid; /**< A local UUID.*/ - char *db_uid; /**< An UID of an user.*/ - char *db_inform_all; - char *db_dump_dir; /**< A debugdump directory of a crash.*/ - char *db_count; /**< Crash rate.*/ - char *db_reported; /**< Is a row reported?*/ - char *db_message; /**< if a row is reported, then there can be store message abotu that*/ - char *db_time; /**< Time of last occurred crash with same local UUID*/ -}; - -void db_row_free(struct db_row *row); - -void db_list_free(GList *list); - -struct db_row *db_rowcpy_from_list(GList* list); - -#ifdef __cplusplus -} -#endif - -#ifdef __cplusplus - -#include -#include - -#include "plugin.h" - -/** - * An abstract class. The class defines a database plugin interface. - */ -class CDatabase : public CPlugin -{ - public: - /** - * A method, which connects to a database. - */ - virtual void Connect() = 0; - /** - * A method, which disconnects from a database. - */ - virtual void DisConnect() = 0; - /** - * A method, which inserts one row to a database. - * @param pUUID A local UUID of a crash. - * @param pUID An UID of an user. - * @param pDebugDumpPath A debugdump path. - * @param pTime Time when a crash occurs. - */ - virtual void Insert_or_Update(const char *crash_id, - bool inform_all_users, - const char *pDebugDumpPath, - const char *pTime) = 0; - /** - * A method, which deletes one row in a database. - * @param pUUID A lodal UUID of a crash. - * @param pUID An UID of an user. - */ - virtual void DeleteRow(const char *crash_id) = 0; - virtual void DeleteRows_by_dir(const char *dump_dir) = 0; - /** - * A method, which sets that particular row was reported. - * @param pUUID A local UUID of a crash. - * @param pUID An UID of an user. - * @param pMessage A text explanation of reported problem - * (where it is stored etc)... - */ - virtual void SetReported(const char *crash_id, - const char *pMessage) = 0; - virtual void SetReportedPerReporter(const char *crash_id, - const char *reporter, - const char *pMessage) = 0; - /** - * A method, which gets all rows which belongs to particular user. - * If the user is root, then all rows are returned. If there are no - * rows, empty vector is returned. - * @param pUID An UID of an user. - * @return A vector of matched rows. - */ - virtual GList *GetUIDData(long caller_uid) = 0; - /** - * A method, which returns one row accordind to UUID of a crash and - * UID of an user. If there are no row, empty row is returned. - * @param pUUID A UUID of a crash. - * @param pUID An UID of an user. - * @return A matched row. - */ - virtual struct db_row *GetRow(const char *crash_id) = 0; - virtual struct db_row *GetRow_by_dir(const char *dir) = 0; -}; -#endif - -#endif -- cgit