aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorDavid Barksdale <amatus.amongus@gmail.com>2014-12-15 00:32:17 +0000
committerDavid Barksdale <amatus.amongus@gmail.com>2014-12-15 00:32:17 +0000
commitbd94aa6fe80a7687c3727ebcdb3ba5185d3b8b11 (patch)
tree02c23cc57494a495c9da5f8e88e282a376ba4016 /src/include
parent6c8fa85819a2b02b3c4a175a08c1779283eda209 (diff)
downloadgnunet-bd94aa6fe80a7687c3727ebcdb3ba5185d3b8b11.tar.gz
gnunet-bd94aa6fe80a7687c3727ebcdb3ba5185d3b8b11.zip
Implement asynchronous peerstore plugin API
Resolves #3506
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_peerstore_plugin.h25
-rw-r--r--src/include/gnunet_peerstore_service.h4
2 files changed, 23 insertions, 6 deletions
diff --git a/src/include/gnunet_peerstore_plugin.h b/src/include/gnunet_peerstore_plugin.h
index 8eea796bb..4ea68f31d 100644
--- a/src/include/gnunet_peerstore_plugin.h
+++ b/src/include/gnunet_peerstore_plugin.h
@@ -59,7 +59,11 @@ struct GNUNET_PEERSTORE_PluginFunctions
59 * @param peer peer identity 59 * @param peer peer identity
60 * @param value value to be stored 60 * @param value value to be stored
61 * @param size size of value to be stored 61 * @param size size of value to be stored
62 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 62 * @param expiry absolute time after which the record is (possibly) deleted
63 * @param options options related to the store operation
64 * @param cont continuation called when record is stored
65 * @param cont_cls continuation closure
66 * @return #GNUNET_OK on success, else #GNUNET_SYSERR and cont is not called
63 */ 67 */
64 int 68 int
65 (*store_record) (void *cls, 69 (*store_record) (void *cls,
@@ -69,7 +73,9 @@ struct GNUNET_PEERSTORE_PluginFunctions
69 const void *value, 73 const void *value,
70 size_t size, 74 size_t size,
71 struct GNUNET_TIME_Absolute expiry, 75 struct GNUNET_TIME_Absolute expiry,
72 enum GNUNET_PEERSTORE_StoreOption options); 76 enum GNUNET_PEERSTORE_StoreOption options,
77 GNUNET_PEERSTORE_Continuation cont,
78 void *cont_cls);
73 79
74 /** 80 /**
75 * Iterate over the records given an optional peer id 81 * Iterate over the records given an optional peer id
@@ -79,9 +85,11 @@ struct GNUNET_PEERSTORE_PluginFunctions
79 * @param sub_system name of sub system 85 * @param sub_system name of sub system
80 * @param peer Peer identity (can be NULL) 86 * @param peer Peer identity (can be NULL)
81 * @param key entry key string (can be NULL) 87 * @param key entry key string (can be NULL)
82 * @param iter function to call with the result 88 * @param iter function to call asynchronously with the results, terminated
89 * by a NULL result
83 * @param iter_cls closure for @a iter 90 * @param iter_cls closure for @a iter
84 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 91 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error and iter is not
92 * called
85 */ 93 */
86 int 94 int
87 (*iterate_records) (void *cls, 95 (*iterate_records) (void *cls,
@@ -95,11 +103,16 @@ struct GNUNET_PEERSTORE_PluginFunctions
95 * 103 *
96 * @param cls closure (internal context for the plugin) 104 * @param cls closure (internal context for the plugin)
97 * @param now time to use as reference 105 * @param now time to use as reference
98 * @return number of records deleted 106 * @param cont continuation called with the number of records expired
107 * @param cont_cls continuation closure
108 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error and cont is not
109 * called
99 */ 110 */
100 int 111 int
101 (*expire_records) (void *cls, 112 (*expire_records) (void *cls,
102 struct GNUNET_TIME_Absolute now); 113 struct GNUNET_TIME_Absolute now,
114 GNUNET_PEERSTORE_Continuation cont,
115 void *cont_cls);
103 116
104}; 117};
105 118
diff --git a/src/include/gnunet_peerstore_service.h b/src/include/gnunet_peerstore_service.h
index 73ecadc8b..a3fed7065 100644
--- a/src/include/gnunet_peerstore_service.h
+++ b/src/include/gnunet_peerstore_service.h
@@ -102,6 +102,10 @@ struct GNUNET_PEERSTORE_Record
102 */ 102 */
103 struct GNUNET_TIME_Absolute *expiry; 103 struct GNUNET_TIME_Absolute *expiry;
104 104
105 /**
106 * Client from which this record originated
107 */
108 struct GNUNET_SERVER_Client *client;
105}; 109};
106 110
107/** 111/**