[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r33320 - in gnunet/src: include peerstore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r33320 - in gnunet/src: include peerstore |
Date: |
Mon, 19 May 2014 12:26:08 +0200 |
Author: otarabai
Date: 2014-05-19 12:26:08 +0200 (Mon, 19 May 2014)
New Revision: 33320
Modified:
gnunet/src/include/gnunet_peerstore_service.h
gnunet/src/peerstore/test_peerstore_api.c
gnunet/src/peerstore/test_peerstore_api_data.conf
Log:
peerstore: completed iterate functionality
Modified: gnunet/src/include/gnunet_peerstore_service.h
===================================================================
--- gnunet/src/include/gnunet_peerstore_service.h 2014-05-19 08:54:34 UTC
(rev 33319)
+++ gnunet/src/include/gnunet_peerstore_service.h 2014-05-19 10:26:08 UTC
(rev 33320)
@@ -153,6 +153,34 @@
void
GNUNET_PEERSTORE_store_cancel (struct GNUNET_PEERSTORE_StoreContext *sc);
+/**
+ * Iterate over records matching supplied key information
+ *
+ * @param h handle to the PEERSTORE service
+ * @param sub_system name of sub system
+ * @param peer Peer identity (can be NULL)
+ * @param key entry key string (can be NULL)
+ * @param timeout time after which the iterate request is canceled
+ * @param callback function called with each matching record, all NULL's on end
+ * @param callback_cls closure for @a callback
+ */
+struct GNUNET_PEERSTORE_IterateContext *
+GNUNET_PEERSTORE_iterate (struct GNUNET_PEERSTORE_Handle *h,
+ char *sub_system,
+ const struct GNUNET_PeerIdentity *peer,
+ const char *key,
+ struct GNUNET_TIME_Relative timeout,
+ GNUNET_PEERSTORE_Processor callback, void *callback_cls);
+
+/**
+ * Cancel an iterate request
+ * Please do not call after the iterate request is done
+ *
+ * @param ic Iterate request context as returned by GNUNET_PEERSTORE_iterate()
+ */
+void
+GNUNET_PEERSTORE_iterate_cancel (struct GNUNET_PEERSTORE_IterateContext *ic);
+
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
Modified: gnunet/src/peerstore/test_peerstore_api.c
===================================================================
--- gnunet/src/peerstore/test_peerstore_api.c 2014-05-19 08:54:34 UTC (rev
33319)
+++ gnunet/src/peerstore/test_peerstore_api.c 2014-05-19 10:26:08 UTC (rev
33320)
@@ -45,6 +45,7 @@
printf("Record:\n");
if(NULL == record)
{
+ GNUNET_assert(counter > 0);
counter = 0;
printf("END\n");
GNUNET_PEERSTORE_disconnect(h);
@@ -53,8 +54,9 @@
printf("Sub system: %s\n", record->sub_system);
printf("Peer: %s\n", GNUNET_i2s (record->peer));
printf("Key: %s\n", record->key);
- printf("Value: %.*s\n", record->value);
+ printf("Value: %.*s\n", record->value_size, record->value);
printf("Expiry: %" PRIu64 "\n", record->expiry->abs_value_us);
+ counter ++;
return GNUNET_YES;
}
@@ -66,7 +68,7 @@
else
ok = 1;
printf("Store success: %d\n", success);
- GNUNET_PEERSTORE_iterate(h, "peerstore-test-value",
+ GNUNET_PEERSTORE_iterate(h, "peerstore-test",
NULL,
NULL,
GNUNET_TIME_UNIT_FOREVER_REL,
Modified: gnunet/src/peerstore/test_peerstore_api_data.conf
===================================================================
--- gnunet/src/peerstore/test_peerstore_api_data.conf 2014-05-19 08:54:34 UTC
(rev 33319)
+++ gnunet/src/peerstore/test_peerstore_api_data.conf 2014-05-19 10:26:08 UTC
(rev 33320)
@@ -7,6 +7,7 @@
UNIXPATH = /tmp/gnunet-service-peerstore.sock
HOME = $SERVICEHOME
DATABASE = sqlite
+#PREFIX = xterm -e gdb --args
[peerstore-sqlite]
FILENAME = $GNUNET_TEST_HOME/gnunet-peerstore-sqlite.db
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r33320 - in gnunet/src: include peerstore,
gnunet <=