index_db.h
Go to the documentation of this file.00001 #ifndef __DB_H__
00002 #define __DB_H__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include <glib.h>
00032 #include <libermetadb/ermetadb.h>
00033
00034 typedef enum {
00035 UNKNOWN = 0,
00036 SAME,
00037 CHANGED,
00038 NEW,
00039 } DBState;
00040
00041 typedef struct
00042 {
00043 gint64 file_id;
00044 const gchar* filename;
00045 const gchar* filepath;
00046 gboolean is_dir;
00047 gint64 filesize;
00048 gint64 last_modified;
00049 DBState state;
00050 } db_entry_t;
00051
00052
00053
00054 typedef struct {
00055 erMetadb mdb;
00056 int transaction_started;
00057 metadata_table *values;
00058 metadata_cell *db;
00059 int num_rows;
00060 int num_cols;
00061 int row;
00062 } db_state_t;
00063
00064 int db_open_global (db_state_t *db_state, const gchar *directory);
00065 void db_close (db_state_t *db_state);
00066
00067 int db_start_transaction (db_state_t *db_state);
00068 int db_end_transaction (db_state_t *db_state);
00069
00070
00071 GSList* db_get_model(const gchar* dir);
00072
00073 void db_add_entry(db_state_t *db_state,
00074 const db_entry_t* entry,
00075 const char* tag,
00076 const char* display_name,
00077 const char* author);
00078 void db_update_entry(db_state_t *db_state, const db_entry_t* entry);
00079 void db_update_shortcut_entry(db_state_t *db_state,
00080 const db_entry_t* entry,
00081 const char* display_name,
00082 const char* author);
00083 int db_delete_entry(db_state_t *db_state, const db_entry_t *entry);
00084
00085 #endif