diff options
author | David Barksdale <amatus.amongus@gmail.com> | 2015-03-21 03:38:29 +0000 |
---|---|---|
committer | David Barksdale <amatus.amongus@gmail.com> | 2015-03-21 03:38:29 +0000 |
commit | c77d4e5c69ac54ffddf5bd60c18bcb0504389311 (patch) | |
tree | bb40b73db6ed428d6ab44ffee91ca0ed6f16b592 /src/datastore/plugin_datastore_heap.c | |
parent | ce6f1156a58aafed6563585b3be560ec0b4eabe7 (diff) | |
download | gnunet-c77d4e5c69ac54ffddf5bd60c18bcb0504389311.tar.gz gnunet-c77d4e5c69ac54ffddf5bd60c18bcb0504389311.zip |
Convert datastore plugin API to asynchronous
Diffstat (limited to 'src/datastore/plugin_datastore_heap.c')
-rw-r--r-- | src/datastore/plugin_datastore_heap.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/datastore/plugin_datastore_heap.c b/src/datastore/plugin_datastore_heap.c index 111a852b4..821fbb4e8 100644 --- a/src/datastore/plugin_datastore_heap.c +++ b/src/datastore/plugin_datastore_heap.c | |||
@@ -206,10 +206,10 @@ heap_plugin_estimate_size (void *cls, unsigned long long *estimate) | |||
206 | * @param anonymity anonymity-level for the content | 206 | * @param anonymity anonymity-level for the content |
207 | * @param replication replication-level for the content | 207 | * @param replication replication-level for the content |
208 | * @param expiration expiration time for the content | 208 | * @param expiration expiration time for the content |
209 | * @param msg set to error message | 209 | * @param cont continuation called with success or failure status |
210 | * @return GNUNET_OK on success | 210 | * @param cont_cls continuation closure |
211 | */ | 211 | */ |
212 | static int | 212 | static void |
213 | heap_plugin_put (void *cls, | 213 | heap_plugin_put (void *cls, |
214 | const struct GNUNET_HashCode * key, | 214 | const struct GNUNET_HashCode * key, |
215 | uint32_t size, | 215 | uint32_t size, |
@@ -217,7 +217,9 @@ heap_plugin_put (void *cls, | |||
217 | enum GNUNET_BLOCK_Type type, | 217 | enum GNUNET_BLOCK_Type type, |
218 | uint32_t priority, uint32_t anonymity, | 218 | uint32_t priority, uint32_t anonymity, |
219 | uint32_t replication, | 219 | uint32_t replication, |
220 | struct GNUNET_TIME_Absolute expiration, char **msg) | 220 | struct GNUNET_TIME_Absolute expiration, |
221 | PluginPutCont cont, | ||
222 | void *cont_cls) | ||
221 | { | 223 | { |
222 | struct Plugin *plugin = cls; | 224 | struct Plugin *plugin = cls; |
223 | struct Value *value; | 225 | struct Value *value; |
@@ -267,7 +269,7 @@ heap_plugin_put (void *cls, | |||
267 | value, | 269 | value, |
268 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 270 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
269 | plugin->size += size; | 271 | plugin->size += size; |
270 | return GNUNET_OK; | 272 | cont (cont_cls, key, size, GNUNET_OK, NULL); |
271 | } | 273 | } |
272 | 274 | ||
273 | 275 | ||
@@ -615,14 +617,16 @@ heap_plugin_get_expiration (void *cls, PluginDatumProcessor proc, | |||
615 | * @param expire new expiration time should be the | 617 | * @param expire new expiration time should be the |
616 | * MAX of any existing expiration time and | 618 | * MAX of any existing expiration time and |
617 | * this value | 619 | * this value |
618 | * @param msg set to error message | 620 | * @param cont continuation called with success or failure status |
619 | * @return GNUNET_OK on success | 621 | * @param cons_cls continuation closure |
620 | */ | 622 | */ |
621 | static int | 623 | static void |
622 | heap_plugin_update (void *cls, | 624 | heap_plugin_update (void *cls, |
623 | uint64_t uid, | 625 | uint64_t uid, |
624 | int delta, | 626 | int delta, |
625 | struct GNUNET_TIME_Absolute expire, char **msg) | 627 | struct GNUNET_TIME_Absolute expire, |
628 | PluginUpdateCont cont, | ||
629 | void *cont_cls) | ||
626 | { | 630 | { |
627 | struct Plugin *plugin = cls; | 631 | struct Plugin *plugin = cls; |
628 | struct Value *value; | 632 | struct Value *value; |
@@ -640,7 +644,7 @@ heap_plugin_update (void *cls, | |||
640 | value->priority = 0; | 644 | value->priority = 0; |
641 | else | 645 | else |
642 | value->priority += delta; | 646 | value->priority += delta; |
643 | return GNUNET_OK; | 647 | cont (cont_cls, GNUNET_OK, NULL); |
644 | } | 648 | } |
645 | 649 | ||
646 | 650 | ||
@@ -778,6 +782,7 @@ heap_get_keys (void *cls, | |||
778 | GNUNET_CONTAINER_multihashmap_iterate (plugin->keyvalue, | 782 | GNUNET_CONTAINER_multihashmap_iterate (plugin->keyvalue, |
779 | &return_value, | 783 | &return_value, |
780 | &gac); | 784 | &gac); |
785 | proc (proc_cls, NULL, 0); | ||
781 | } | 786 | } |
782 | 787 | ||
783 | 788 | ||