aboutsummaryrefslogtreecommitdiff
path: root/src/datastore/plugin_datastore_template.c
diff options
context:
space:
mode:
authorDavid Barksdale <amatus@amat.us>2017-04-16 12:39:43 -0500
committerDavid Barksdale <amatus@amat.us>2017-04-16 12:42:34 -0500
commit4907330f51ffd48af1f7bac6f43c7c7f78c37818 (patch)
treea2cd65dbb24ea5caeda1fff2521f935dd7ea6256 /src/datastore/plugin_datastore_template.c
parentcacd64d8635201459e59bf2cd8a2ea8fd0699b84 (diff)
downloadgnunet-4907330f51ffd48af1f7bac6f43c7c7f78c37818.tar.gz
gnunet-4907330f51ffd48af1f7bac6f43c7c7f78c37818.zip
[datastore] Combine put and update plugin APIs
This resolves issue #4965.
Diffstat (limited to 'src/datastore/plugin_datastore_template.c')
-rw-r--r--src/datastore/plugin_datastore_template.c49
1 files changed, 11 insertions, 38 deletions
diff --git a/src/datastore/plugin_datastore_template.c b/src/datastore/plugin_datastore_template.c
index 8e44f020d..704d586bc 100644
--- a/src/datastore/plugin_datastore_template.c
+++ b/src/datastore/plugin_datastore_template.c
@@ -62,6 +62,7 @@ template_plugin_estimate_size (void *cls, unsigned long long *estimate)
62 * 62 *
63 * @param cls closure 63 * @param cls closure
64 * @param key key for the item 64 * @param key key for the item
65 * @param absent true if the key was not found in the bloom filter
65 * @param size number of bytes in data 66 * @param size number of bytes in data
66 * @param data content stored 67 * @param data content stored
67 * @param type type of the content 68 * @param type type of the content
@@ -73,11 +74,17 @@ template_plugin_estimate_size (void *cls, unsigned long long *estimate)
73 * @param cont_cls continuation closure 74 * @param cont_cls continuation closure
74 */ 75 */
75static void 76static void
76template_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t size, 77template_plugin_put (void *cls,
77 const void *data, enum GNUNET_BLOCK_Type type, 78 const struct GNUNET_HashCode *key,
78 uint32_t priority, uint32_t anonymity, 79 bool absent,
80 uint32_t size,
81 const void *data,
82 enum GNUNET_BLOCK_Type type,
83 uint32_t priority,
84 uint32_t anonymity,
79 uint32_t replication, 85 uint32_t replication,
80 struct GNUNET_TIME_Absolute expiration, PluginPutCont cont, 86 struct GNUNET_TIME_Absolute expiration,
87 PluginPutCont cont,
81 void *cont_cls) 88 void *cont_cls)
82{ 89{
83 GNUNET_break (0); 90 GNUNET_break (0);
@@ -151,39 +158,6 @@ template_plugin_get_expiration (void *cls, PluginDatumProcessor proc,
151 158
152 159
153/** 160/**
154 * Update the priority, replication and expiration for a particular
155 * unique ID in the datastore. If the expiration time in value is
156 * different than the time found in the datastore, the higher value
157 * should be kept. The specified priority and replication is added
158 * to the existing value.
159 *
160 * @param cls our "struct Plugin*"
161 * @param uid unique identifier of the datum
162 * @param priority by how much should the priority
163 * change?
164 * @param replication by how much should the replication
165 * change?
166 * @param expire new expiration time should be the
167 * MAX of any existing expiration time and
168 * this value
169 * @param cont continuation called with success or failure status
170 * @param cons_cls continuation closure
171 */
172static void
173template_plugin_update (void *cls,
174 uint64_t uid,
175 uint32_t priority,
176 uint32_t replication,
177 struct GNUNET_TIME_Absolute expire,
178 PluginUpdateCont cont,
179 void *cont_cls)
180{
181 GNUNET_break (0);
182 cont (cont_cls, GNUNET_SYSERR, "not implemented");
183}
184
185
186/**
187 * Call the given processor on an item with zero anonymity. 161 * Call the given processor on an item with zero anonymity.
188 * 162 *
189 * @param cls our "struct Plugin*" 163 * @param cls our "struct Plugin*"
@@ -248,7 +222,6 @@ libgnunet_plugin_datastore_template_init (void *cls)
248 api->cls = plugin; 222 api->cls = plugin;
249 api->estimate_size = &template_plugin_estimate_size; 223 api->estimate_size = &template_plugin_estimate_size;
250 api->put = &template_plugin_put; 224 api->put = &template_plugin_put;
251 api->update = &template_plugin_update;
252 api->get_key = &template_plugin_get_key; 225 api->get_key = &template_plugin_get_key;
253 api->get_replication = &template_plugin_get_replication; 226 api->get_replication = &template_plugin_get_replication;
254 api->get_expiration = &template_plugin_get_expiration; 227 api->get_expiration = &template_plugin_get_expiration;