[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r13419 - gnunet/src/datastore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r13419 - gnunet/src/datastore |
Date: |
Wed, 27 Oct 2010 11:39:41 +0200 |
Author: wachs
Date: 2010-10-27 11:39:41 +0200 (Wed, 27 Oct 2010)
New Revision: 13419
Modified:
gnunet/src/datastore/datastore_api.c
gnunet/src/datastore/gnunet-service-datastore.c
gnunet/src/datastore/perf_datastore_api.c
gnunet/src/datastore/perf_plugin_datastore.c
gnunet/src/datastore/plugin_datastore_mysql.c
gnunet/src/datastore/plugin_datastore_postgres.c
gnunet/src/datastore/plugin_datastore_sqlite.c
gnunet/src/datastore/test_datastore_api.c
gnunet/src/datastore/test_datastore_api_management.c
Log:
Refactoring gnunet time
Modified: gnunet/src/datastore/datastore_api.c
===================================================================
--- gnunet/src/datastore/datastore_api.c 2010-10-27 09:38:04 UTC (rev
13418)
+++ gnunet/src/datastore/datastore_api.c 2010-10-27 09:39:41 UTC (rev
13419)
@@ -500,11 +500,11 @@
{
struct GNUNET_DATASTORE_Handle *h = cls;
- if (h->retry_time.value < GNUNET_CONSTANTS_SERVICE_RETRY.value)
+ if (h->retry_time.rel_value < GNUNET_CONSTANTS_SERVICE_RETRY.rel_value)
h->retry_time = GNUNET_CONSTANTS_SERVICE_RETRY;
else
h->retry_time = GNUNET_TIME_relative_multiply (h->retry_time, 2);
- if (h->retry_time.value > GNUNET_CONSTANTS_SERVICE_TIMEOUT.value)
+ if (h->retry_time.rel_value > GNUNET_CONSTANTS_SERVICE_TIMEOUT.rel_value)
h->retry_time = GNUNET_CONSTANTS_SERVICE_TIMEOUT;
h->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
h->client = GNUNET_CLIENT_connect (h->sched, "datastore", h->cfg);
@@ -784,7 +784,7 @@
gettext_noop ("# status messages received"),
1,
GNUNET_NO);
- h->retry_time.value = 0;
+ h->retry_time.rel_value = 0;
process_queue (h);
if (rc.cont != NULL)
rc.cont (rc.cont_cls,
@@ -1055,7 +1055,7 @@
"Asked to update entry %llu raising priority by %u and expiration
to %llu\n",
uid,
(unsigned int) priority,
- (unsigned long long) expiration.value);
+ (unsigned long long) expiration.abs_value);
#endif
qc.sc.cont = cont;
qc.sc.cont_cls = cont_cls;
@@ -1221,7 +1221,7 @@
rc.iter (rc.iter_cls,
NULL, 0, NULL, 0, 0, 0,
GNUNET_TIME_UNIT_ZERO_ABS, 0);
- h->retry_time.value = 0;
+ h->retry_time.rel_value = 0;
h->result_count = 0;
process_queue (h);
return;
@@ -1274,7 +1274,7 @@
ntohl(dm->size),
GNUNET_h2s(&dm->key));
#endif
- h->retry_time.value = 0;
+ h->retry_time.rel_value = 0;
rc.iter (rc.iter_cls,
&dm->key,
ntohl(dm->size),
@@ -1318,7 +1318,7 @@
#if DEBUG_DATASTORE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Asked to get random entry in %llu ms\n",
- (unsigned long long) timeout.value);
+ (unsigned long long) timeout.abs_value);
#endif
qc.rc.iter = iter;
qc.rc.iter_cls = iter_cls;
@@ -1378,7 +1378,7 @@
#if DEBUG_DATASTORE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Asked to get zero-anonymity entry in %llu ms\n",
- (unsigned long long) timeout.value);
+ (unsigned long long) timeout.abs_value);
#endif
qc.rc.iter = iter;
qc.rc.iter_cls = iter_cls;
Modified: gnunet/src/datastore/gnunet-service-datastore.c
===================================================================
--- gnunet/src/datastore/gnunet-service-datastore.c 2010-10-27 09:38:04 UTC
(rev 13418)
+++ gnunet/src/datastore/gnunet-service-datastore.c 2010-10-27 09:39:41 UTC
(rev 13419)
@@ -350,7 +350,7 @@
return GNUNET_SYSERR;
}
now = GNUNET_TIME_absolute_get ();
- if (expiration.value > now.value)
+ if (expiration.abs_value > now.abs_value)
{
/* finished processing */
plugin->api->next_request (next_cls, GNUNET_YES);
@@ -362,7 +362,7 @@
"Deleting content `%s' of type %u that expired %llu ms ago\n",
GNUNET_h2s (key),
type,
- (unsigned long long) (now.value - expiration.value));
+ (unsigned long long) (now.abs_value - expiration.abs_value));
#endif
GNUNET_STATISTICS_update (stats,
gettext_noop ("# bytes expired"),
@@ -1486,7 +1486,7 @@
#if DEBUG_SQLITE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Notification from statistics about existing payload (%llu), new
payload is %llu\n",
- value,
+ abs_value,
payload);
#endif
return GNUNET_OK;
Modified: gnunet/src/datastore/perf_datastore_api.c
===================================================================
--- gnunet/src/datastore/perf_datastore_api.c 2010-10-27 09:38:04 UTC (rev
13418)
+++ gnunet/src/datastore/perf_datastore_api.c 2010-10-27 09:39:41 UTC (rev
13419)
@@ -295,7 +295,7 @@
"Stored %llu kB / %lluk ops / %llu ops/s\n",
stored_bytes / 1024, /* used size in k */
stored_ops / 1024, /* total operations (in k) */
- 1000 * stored_ops / (1 +
GNUNET_TIME_absolute_get_duration(start_time).value));
+ 1000 * stored_ops / (1 +
GNUNET_TIME_absolute_get_duration(start_time).rel_value));
crc->phase = RP_PUT;
crc->j = 0;
GNUNET_SCHEDULER_add_continuation (crc->sched,
Modified: gnunet/src/datastore/perf_plugin_datastore.c
===================================================================
--- gnunet/src/datastore/perf_plugin_datastore.c 2010-10-27 09:38:04 UTC
(rev 13418)
+++ gnunet/src/datastore/perf_plugin_datastore.c 2010-10-27 09:39:41 UTC
(rev 13419)
@@ -114,7 +114,7 @@
size = size - (size & 7); /* always multiple of 8 */
/* generate random key */
- key.bits[0] = (unsigned int) GNUNET_TIME_absolute_get ().value;
+ key.bits[0] = (unsigned int) GNUNET_TIME_absolute_get ().abs_value;
GNUNET_CRYPTO_hash (&key, sizeof (GNUNET_HashCode), &key);
memset (value, i, size);
if (i > 255)
@@ -170,7 +170,7 @@
crc->end = GNUNET_TIME_absolute_get();
printf (crc->msg,
crc->i,
- (unsigned long long) (crc->end.value - crc->start.value),
+ (unsigned long long) (crc->end.abs_value - crc->start.abs_value),
crc->cnt);
if (crc->phase != RP_AN_GET)
{
@@ -191,7 +191,7 @@
#if VERBOSE
fprintf (stderr, "Found result type=%u, priority=%u, size=%u, expire=%llu\n",
type, priority, size,
- (unsigned long long) expiration.value);
+ (unsigned long long) expiration.abs_value);
#endif
crc->cnt++;
crc->api->next_request (next_cls,
@@ -263,7 +263,7 @@
crc->end = GNUNET_TIME_absolute_get ();
printf ("%3u insertion took %20llums for %u\n",
crc->i,
- (unsigned long long) (crc->end.value - crc->start.value),
+ (unsigned long long) (crc->end.abs_value - crc->start.abs_value),
(unsigned int) PUT_10);
crc->i++;
crc->phase = RP_LP_GET;
Modified: gnunet/src/datastore/plugin_datastore_mysql.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_mysql.c 2010-10-27 09:38:04 UTC
(rev 13418)
+++ gnunet/src/datastore/plugin_datastore_mysql.c 2010-10-27 09:39:41 UTC
(rev 13419)
@@ -1062,7 +1062,7 @@
&nrc->last_vkey,
GNUNET_YES,
MYSQL_TYPE_LONGLONG,
- &nrc->now.value,
+ &nrc->now.abs_value,
GNUNET_YES,
MYSQL_TYPE_LONGLONG,
&nrc->last_expire,
@@ -1071,7 +1071,7 @@
&nrc->last_vkey,
GNUNET_YES,
MYSQL_TYPE_LONGLONG,
- &nrc->now.value,
+ &nrc->now.abs_value,
GNUNET_YES, -1);
break;
default:
@@ -1199,7 +1199,7 @@
exp);
#endif
GNUNET_assert (nrc->plugin->next_task == GNUNET_SCHEDULER_NO_TASK);
- expiration.value = exp;
+ expiration.abs_value = exp;
ret = nrc->dviter (nrc->dviter_cls,
nrc,
&key,
@@ -1368,7 +1368,7 @@
unsigned int itype = type;
unsigned int ipriority = priority;
unsigned int ianonymity = anonymity;
- unsigned long long lexpiration = expiration.value;
+ unsigned long long lexpiration = expiration.abs_value;
unsigned long hashSize;
unsigned long hashSize2;
unsigned long long vkey;
@@ -1720,7 +1720,7 @@
{
struct Plugin *plugin = cls;
unsigned long long vkey = uid;
- unsigned long long lexpire = expire.value;
+ unsigned long long lexpire = expire.abs_value;
int ret;
#if DEBUG_MYSQL
Modified: gnunet/src/datastore/plugin_datastore_postgres.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_postgres.c 2010-10-27 09:38:04 UTC
(rev 13418)
+++ gnunet/src/datastore/plugin_datastore_postgres.c 2010-10-27 09:39:41 UTC
(rev 13419)
@@ -767,12 +767,12 @@
type = ntohl (*(uint32_t *) PQgetvalue (res, 0, 0));
priority = ntohl (*(uint32_t *) PQgetvalue (res, 0, 1));
anonymity = ntohl ( *(uint32_t *) PQgetvalue (res, 0, 2));
- expiration_time.value = GNUNET_ntohll (*(uint64_t *) PQgetvalue (res, 0, 3));
+ expiration_time.abs_value = GNUNET_ntohll (*(uint64_t *) PQgetvalue (res, 0,
3));
memcpy (&key, PQgetvalue (res, 0, 4), sizeof (GNUNET_HashCode));
size = PQgetlength (res, 0, 5);
nrc->blast_prio = htonl (priority);
- nrc->blast_expire = GNUNET_htonll (expiration_time.value);
+ nrc->blast_expire = GNUNET_htonll (expiration_time.abs_value);
nrc->blast_rowid = htonl (rowid);
nrc->count++;
Modified: gnunet/src/datastore/plugin_datastore_sqlite.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_sqlite.c 2010-10-27 09:38:04 UTC
(rev 13418)
+++ gnunet/src/datastore/plugin_datastore_sqlite.c 2010-10-27 09:39:41 UTC
(rev 13419)
@@ -556,7 +556,7 @@
priority = sqlite3_column_int (nc->stmt, 2);
anonymity = sqlite3_column_int (nc->stmt, 3);
- expiration.value = sqlite3_column_int64 (nc->stmt, 4);
+ expiration.abs_value = sqlite3_column_int64 (nc->stmt, 4);
key = sqlite3_column_blob (nc->stmt, 5);
nc->lastPriority = priority;
nc->lastExpiration = expiration;
@@ -667,8 +667,8 @@
type,
GNUNET_h2s(key),
priority,
- (unsigned long long) GNUNET_TIME_absolute_get_remaining
(expiration).value,
- (long long) expiration.value);
+ (unsigned long long) GNUNET_TIME_absolute_get_remaining
(expiration).abs_value,
+ (long long) expiration.abs_value);
#endif
GNUNET_CRYPTO_hash (data, size, &vhash);
stmt = plugin->insertContent;
@@ -676,7 +676,7 @@
(SQLITE_OK != sqlite3_bind_int (stmt, 2, type)) ||
(SQLITE_OK != sqlite3_bind_int (stmt, 3, priority)) ||
(SQLITE_OK != sqlite3_bind_int (stmt, 4, anonymity)) ||
- (SQLITE_OK != sqlite3_bind_int64 (stmt, 5, expiration.value)) ||
+ (SQLITE_OK != sqlite3_bind_int64 (stmt, 5, expiration.abs_value)) ||
(SQLITE_OK !=
sqlite3_bind_blob (stmt, 6, key, sizeof (GNUNET_HashCode),
SQLITE_TRANSIENT)) ||
@@ -763,7 +763,7 @@
int n;
sqlite3_bind_int (plugin->updPrio, 1, delta);
- sqlite3_bind_int64 (plugin->updPrio, 2, expire.value);
+ sqlite3_bind_int64 (plugin->updPrio, 2, expire.abs_value);
sqlite3_bind_int64 (plugin->updPrio, 3, uid);
n = sqlite3_step (plugin->updPrio);
if (n != SQLITE_DONE)
@@ -871,10 +871,10 @@
#if DEBUG_SQLITE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Restricting to results larger than the last expiration
%llu\n",
- (unsigned long long) nc->lastExpiration.value);
+ (unsigned long long) nc->lastExpiration.abs_value);
#endif
- sqlite3_bind_int64 (ic->stmt_1, 1, nc->lastExpiration.value);
- sqlite3_bind_int64 (ic->stmt_2, 1, nc->lastExpiration.value);
+ sqlite3_bind_int64 (ic->stmt_1, 1, nc->lastExpiration.abs_value);
+ sqlite3_bind_int64 (ic->stmt_2, 1, nc->lastExpiration.abs_value);
}
#if DEBUG_SQLITE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -974,7 +974,7 @@
#if DEBUG_SQLITE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"At %llu, using queries `%s' and `%s'\n",
- (unsigned long long) GNUNET_TIME_absolute_get ().value,
+ (unsigned long long) GNUNET_TIME_absolute_get ().abs_value,
stmt_str_1,
stmt_str_2);
#endif
@@ -1014,13 +1014,13 @@
if (is_asc)
{
nc->lastPriority = 0;
- nc->lastExpiration.value = 0;
+ nc->lastExpiration.abs_value = 0;
memset (&nc->lastKey, 0, sizeof (GNUNET_HashCode));
}
else
{
nc->lastPriority = 0x7FFFFFFF;
- nc->lastExpiration.value = 0x7FFFFFFFFFFFFFFFLL;
+ nc->lastExpiration.abs_value = 0x7FFFFFFFFFFFFFFFLL;
memset (&nc->lastKey, 255, sizeof (GNUNET_HashCode));
}
sqlite_next_request (nc, GNUNET_NO);
@@ -1077,9 +1077,9 @@
now = GNUNET_TIME_absolute_get ();
GNUNET_asprintf (&q1, SELECT_IT_NON_ANONYMOUS_1,
- (unsigned long long) now.value);
+ (unsigned long long) now.abs_value);
GNUNET_asprintf (&q2, SELECT_IT_NON_ANONYMOUS_2,
- (unsigned long long) now.value);
+ (unsigned long long) now.abs_value);
basic_iter (cls,
type,
GNUNET_NO, GNUNET_YES,
@@ -1116,9 +1116,9 @@
now = GNUNET_TIME_absolute_get ();
GNUNET_asprintf (&q1, SELECT_IT_EXPIRATION_TIME_1,
- (unsigned long long) 0*now.value);
+ (unsigned long long) 0*now.abs_value);
GNUNET_asprintf (&q2, SELECT_IT_EXPIRATION_TIME_2,
- (unsigned long long) 0*now.value);
+ (unsigned long long) 0*now.abs_value);
basic_iter (cls,
type,
GNUNET_YES, GNUNET_NO,
@@ -1152,7 +1152,7 @@
now = GNUNET_TIME_absolute_get ();
GNUNET_asprintf (&q, SELECT_IT_MIGRATION_ORDER_2,
- (unsigned long long) now.value);
+ (unsigned long long) now.abs_value);
basic_iter (cls,
type,
GNUNET_NO, GNUNET_NO,
Modified: gnunet/src/datastore/test_datastore_api.c
===================================================================
--- gnunet/src/datastore/test_datastore_api.c 2010-10-27 09:38:04 UTC (rev
13418)
+++ gnunet/src/datastore/test_datastore_api.c 2010-10-27 09:39:41 UTC (rev
13419)
@@ -95,7 +95,7 @@
{
struct GNUNET_TIME_Absolute av;
- av.value = now.value + 20000000 - i * 1000;
+ av.abs_value = now.abs_value + 20000000 - i * 1000;
return av;
}
@@ -213,7 +213,7 @@
GNUNET_assert (type == get_type (i));
GNUNET_assert (priority == get_priority (i));
GNUNET_assert (anonymity == get_anonymity(i));
- GNUNET_assert (expiration.value == get_expiration(i).value);
+ GNUNET_assert (expiration.abs_value == get_expiration(i).abs_value);
GNUNET_DATASTORE_get_next (datastore, GNUNET_YES);
}
Modified: gnunet/src/datastore/test_datastore_api_management.c
===================================================================
--- gnunet/src/datastore/test_datastore_api_management.c 2010-10-27
09:38:04 UTC (rev 13418)
+++ gnunet/src/datastore/test_datastore_api_management.c 2010-10-27
09:39:41 UTC (rev 13419)
@@ -91,7 +91,7 @@
{
struct GNUNET_TIME_Absolute av;
- av.value = now.value + i * 1000;
+ av.abs_value = now.abs_value + i * 1000;
return av;
}
@@ -183,7 +183,7 @@
GNUNET_assert (type == get_type (i));
GNUNET_assert (priority == get_priority (i));
GNUNET_assert (anonymity == get_anonymity(i));
- GNUNET_assert (expiration.value == get_expiration(i).value);
+ GNUNET_assert (expiration.abs_value == get_expiration(i).abs_value);
GNUNET_DATASTORE_get_next (datastore, GNUNET_YES);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r13419 - gnunet/src/datastore,
gnunet <=