diff options
author | Charlie Brej <cbrej@cs.man.ac.uk> | 2010-08-08 21:17:23 +0100 |
---|---|---|
committer | Charlie Brej <cbrej@cs.man.ac.uk> | 2010-08-08 21:17:23 +0100 |
commit | 2a0a4e8e810da02fb00c570c533df52397902ff2 (patch) | |
tree | 21424c9c88cec33cc1db80c661da7e9f03dc2888 | |
parent | fb0a503c21837e70c368c918e9837e34e2e33803 (diff) |
Remove the _record at the end of insert and fetch operations
Obviously these work with records
-rw-r--r-- | src/libtidbit/tidbit-database-fork.c | 10 | ||||
-rw-r--r-- | src/libtidbit/tidbit-database.c | 4 | ||||
-rw-r--r-- | src/libtidbit/tidbit-database.h | 4 | ||||
-rw-r--r-- | src/libtidbit/tidbit.h | 4 | ||||
-rw-r--r-- | src/main.c | 7 | ||||
-rw-r--r-- | src/tidbit-dbus.c | 4 | ||||
-rw-r--r-- | src/tidbit-http.c | 4 |
7 files changed, 15 insertions, 22 deletions
diff --git a/src/libtidbit/tidbit-database-fork.c b/src/libtidbit/tidbit-database-fork.c index b56366b..6d04c84 100644 --- a/src/libtidbit/tidbit-database-fork.c +++ b/src/libtidbit/tidbit-database-fork.c @@ -61,18 +61,18 @@ static void tidbit_database_fork_free (PtrTidbitDatabase database) static unsigned int tidbit_database_fork_insert (PtrTidbitDatabase database, PtrTidbitRecord record) { PtrTidbitDatabaseFork backend = GET_FORK_BACKEND(database); - tidbit_database_insert_record (backend->sub_a, record); - return tidbit_database_insert_record (backend->sub_b, record); //FIXME combine success + tidbit_database_insert (backend->sub_a, record); + return tidbit_database_insert (backend->sub_b, record); //FIXME combine success } static PtrTidbitRecord tidbit_database_fork_fetch (PtrTidbitDatabase database, PtrTidbitGuid guid) { PtrTidbitDatabaseFork backend = GET_FORK_BACKEND(database); - PtrTidbitRecord record = tidbit_database_fetch_record (backend->sub_a, guid); + PtrTidbitRecord record = tidbit_database_fetch (backend->sub_a, guid); if (!record) { - record = tidbit_database_fetch_record (backend->sub_b, guid); + record = tidbit_database_fetch (backend->sub_b, guid); if (record && backend->caching){ - tidbit_database_insert_record (database, record); + tidbit_database_insert (database, record); } } return record; diff --git a/src/libtidbit/tidbit-database.c b/src/libtidbit/tidbit-database.c index 89d4a4f..3e211bb 100644 --- a/src/libtidbit/tidbit-database.c +++ b/src/libtidbit/tidbit-database.c @@ -52,7 +52,7 @@ void tidbit_database_unref (PtrTidbitDatabase database) tidbit_database_free (database); } -unsigned int tidbit_database_insert_record (PtrTidbitDatabase database, PtrTidbitRecord record) +unsigned int tidbit_database_insert (PtrTidbitDatabase database, PtrTidbitRecord record) { g_assert(database); g_assert(record); @@ -60,7 +60,7 @@ unsigned int tidbit_database_insert_record (PtrTidbitDatabase database, PtrTidbi return database->functions->insert(database, record); } -PtrTidbitRecord tidbit_database_fetch_record (PtrTidbitDatabase database, PtrTidbitGuid guid) +PtrTidbitRecord tidbit_database_fetch (PtrTidbitDatabase database, PtrTidbitGuid guid) { g_assert(database); g_assert(guid); diff --git a/src/libtidbit/tidbit-database.h b/src/libtidbit/tidbit-database.h index ccd4fd5..0075c10 100644 --- a/src/libtidbit/tidbit-database.h +++ b/src/libtidbit/tidbit-database.h @@ -42,8 +42,8 @@ PtrTidbitDatabase tidbit_database_new (gpointer backend, PtrTidbitDatabaseFuncti /* In tidbit.h void tidbit_database_ref (PtrTidbitDatabase database); void tidbit_database_unref (PtrTidbitDatabase database); -unsigned int tidbit_database_insert_record (PtrTidbitDatabase database, PtrTidbitRecord record); -PtrTidbitRecord tidbit_database_fetch_record (PtrTidbitDatabase database, PtrTidbitGuid guid); +unsigned int tidbit_database_insert (PtrTidbitDatabase database, PtrTidbitRecord record); +PtrTidbitRecord tidbit_database_fetch (PtrTidbitDatabase database, PtrTidbitGuid guid); PtrTidbitGuidSet tidbit_database_query (PtrTidbitDatabase database, PtrTidbitQuery query); */ diff --git a/src/libtidbit/tidbit.h b/src/libtidbit/tidbit.h index 2db38c9..cad35a1 100644 --- a/src/libtidbit/tidbit.h +++ b/src/libtidbit/tidbit.h @@ -60,8 +60,8 @@ void tidbit_record_sign (PtrTidbitRecord record, PtrTidbitKey key); void tidbit_database_ref (PtrTidbitDatabase database); void tidbit_database_unref (PtrTidbitDatabase database); -unsigned int tidbit_database_insert_record (PtrTidbitDatabase database, PtrTidbitRecord record); -PtrTidbitRecord tidbit_database_fetch_record (PtrTidbitDatabase database, PtrTidbitGuid guid); +unsigned int tidbit_database_insert (PtrTidbitDatabase database, PtrTidbitRecord record); +PtrTidbitRecord tidbit_database_fetch (PtrTidbitDatabase database, PtrTidbitGuid guid); PtrTidbitGuidSet tidbit_database_query (PtrTidbitDatabase database, PtrTidbitQuery query); PtrTidbitDatabase tidbit_database_dbus_new (void); @@ -31,13 +31,6 @@ GMainLoop *main_loop; -void print_guid (PtrTidbitGuid guid, gpointer database) -{ - PtrTidbitRecord record = tidbit_database_fetch_record (database, guid); - g_print("Got: %s\n", record->raw); - tidbit_record_unref (record); -} - void main_quit(void) { g_main_loop_quit (main_loop); diff --git a/src/tidbit-dbus.c b/src/tidbit-dbus.c index 7d354d4..9a43c66 100644 --- a/src/tidbit-dbus.c +++ b/src/tidbit-dbus.c @@ -82,7 +82,7 @@ gboolean tidbit_dbus_insert (TidbitDbus *object, gchar *record, gboolean *succes { TidbitDbus *tidbit_dbus = TIDBIT_DBUS (object); PtrTidbitRecord new_record = tidbit_record_from_raw (record); //FIXME check record is ok - tidbit_database_insert_record (tidbit_dbus->database, new_record); + tidbit_database_insert (tidbit_dbus->database, new_record); tidbit_record_unref (new_record); *success = TRUE; return TRUE; @@ -92,7 +92,7 @@ gboolean tidbit_dbus_fetch (TidbitDbus *object, gchar *signature, gchar **reply_ { TidbitDbus *tidbit_dbus = TIDBIT_DBUS (object); PtrTidbitGuid guid = tidbit_guid_new (signature); - PtrTidbitRecord record = tidbit_database_fetch_record (tidbit_dbus->database, guid); + PtrTidbitRecord record = tidbit_database_fetch (tidbit_dbus->database, guid); tidbit_guid_unref (guid); if (record) { *reply_record = g_strdup(record->raw); diff --git a/src/tidbit-http.c b/src/tidbit-http.c index 6582cca..886dc61 100644 --- a/src/tidbit-http.c +++ b/src/tidbit-http.c @@ -39,7 +39,7 @@ static void tidbit_http_callback_insert (SoupServer *server, SoupMessage *msg, c g_assert(record->status == TIDBIT_RECORD_STATUS_SIGNED); // g_print("inserted %s\n", record->guid->string); - tidbit_database_insert_record (database, record); + tidbit_database_insert (database, record); soup_message_set_status (msg, SOUP_STATUS_OK); soup_message_set_response (msg, "text/plain", SOUP_MEMORY_STATIC, "KTHXBAI", strlen("KTHXBAI")); } @@ -52,7 +52,7 @@ static void tidbit_http_callback_fetch (SoupServer *server, SoupMessage *msg, co // g_print("fetch: %s\n", guid_str); g_assert(guid_str); PtrTidbitGuid guid = tidbit_guid_new (guid_str); - PtrTidbitRecord record = tidbit_database_fetch_record (database, guid); + PtrTidbitRecord record = tidbit_database_fetch (database, guid); g_assert(record); soup_message_set_status (msg, SOUP_STATUS_OK); soup_message_set_response (msg, "text/plain", SOUP_MEMORY_COPY, record->raw, strlen(record->raw)); |