diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-04-29 07:49:04 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-04-29 07:49:04 +0000 |
commit | d9dcf9e5754ba3dadb7a6e75b2056863f21b84b4 (patch) | |
tree | 1636005cfec014f61f523ed95fd43beb32153fc7 /src/datacache/plugin_datacache_template.c | |
parent | 5474ff8eae33b31f0d6f9ea0498d5e39432cb28b (diff) | |
download | gnunet-d9dcf9e5754ba3dadb7a6e75b2056863f21b84b4.tar.gz gnunet-d9dcf9e5754ba3dadb7a6e75b2056863f21b84b4.zip |
-doxygen, updating template to reflect extended API
Diffstat (limited to 'src/datacache/plugin_datacache_template.c')
-rw-r--r-- | src/datacache/plugin_datacache_template.c | 62 |
1 files changed, 43 insertions, 19 deletions
diff --git a/src/datacache/plugin_datacache_template.c b/src/datacache/plugin_datacache_template.c index ff0119e69..86e0675c1 100644 --- a/src/datacache/plugin_datacache_template.c +++ b/src/datacache/plugin_datacache_template.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2006, 2009 Christian Grothoff (and other contributing authors) | 3 | Copyright (C) 2006, 2009, 2015 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -43,19 +43,22 @@ struct Plugin | |||
43 | /** | 43 | /** |
44 | * Store an item in the datastore. | 44 | * Store an item in the datastore. |
45 | * | 45 | * |
46 | * @param cls closure (our "struct Plugin") | 46 | * @param cls closure (our `struct Plugin`) |
47 | * @param key key to store data under | 47 | * @param key key to store @a data under |
48 | * @param size number of bytes in data | 48 | * @param size number of bytes in @a data |
49 | * @param data data to store | 49 | * @param data data to store |
50 | * @param type type of the value | 50 | * @param type type of the value |
51 | * @param discard_time when to discard the value in any case | 51 | * @param discard_time when to discard the value in any case |
52 | * @param path_info_len number of entries in 'path_info' | 52 | * @param path_info_len number of entries in @a path_info |
53 | * @param path_info a path through the network | 53 | * @param path_info a path through the network |
54 | * @return 0 if duplicate, -1 on error, number of bytes used otherwise | 54 | * @return 0 if duplicate, -1 on error, number of bytes used otherwise |
55 | */ | 55 | */ |
56 | static ssize_t | 56 | static ssize_t |
57 | template_plugin_put (void *cls, const struct GNUNET_HashCode * key, size_t size, | 57 | template_plugin_put (void *cls, |
58 | const char *data, enum GNUNET_BLOCK_Type type, | 58 | const struct GNUNET_HashCode *key, |
59 | size_t size, | ||
60 | const char *data, | ||
61 | enum GNUNET_BLOCK_Type type, | ||
59 | struct GNUNET_TIME_Absolute discard_time, | 62 | struct GNUNET_TIME_Absolute discard_time, |
60 | unsigned int path_info_len, | 63 | unsigned int path_info_len, |
61 | const struct GNUNET_PeerIdentity *path_info) | 64 | const struct GNUNET_PeerIdentity *path_info) |
@@ -69,17 +72,19 @@ template_plugin_put (void *cls, const struct GNUNET_HashCode * key, size_t size, | |||
69 | * Iterate over the results for a particular key | 72 | * Iterate over the results for a particular key |
70 | * in the datastore. | 73 | * in the datastore. |
71 | * | 74 | * |
72 | * @param cls closure (our "struct Plugin") | 75 | * @param cls closure (our `struct Plugin`) |
73 | * @param key | 76 | * @param key |
74 | * @param type entries of which type are relevant? | 77 | * @param type entries of which type are relevant? |
75 | * @param iter maybe NULL (to just count) | 78 | * @param iter maybe NULL (to just count) |
76 | * @param iter_cls closure for iter | 79 | * @param iter_cls closure for @a iter |
77 | * @return the number of results found | 80 | * @return the number of results found |
78 | */ | 81 | */ |
79 | static unsigned int | 82 | static unsigned int |
80 | template_plugin_get (void *cls, const struct GNUNET_HashCode * key, | 83 | template_plugin_get (void *cls, |
84 | const struct GNUNET_HashCode *key, | ||
81 | enum GNUNET_BLOCK_Type type, | 85 | enum GNUNET_BLOCK_Type type, |
82 | GNUNET_DATACACHE_Iterator iter, void *iter_cls) | 86 | GNUNET_DATACACHE_Iterator iter, |
87 | void *iter_cls) | ||
83 | { | 88 | { |
84 | GNUNET_break (0); | 89 | GNUNET_break (0); |
85 | return 0; | 90 | return 0; |
@@ -90,8 +95,8 @@ template_plugin_get (void *cls, const struct GNUNET_HashCode * key, | |||
90 | * Delete the entry with the lowest expiration value | 95 | * Delete the entry with the lowest expiration value |
91 | * from the datacache right now. | 96 | * from the datacache right now. |
92 | * | 97 | * |
93 | * @param cls closure (our "struct Plugin") | 98 | * @param cls closure (our `struct Plugin`) |
94 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 99 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
95 | */ | 100 | */ |
96 | static int | 101 | static int |
97 | template_plugin_del (void *cls) | 102 | template_plugin_del (void *cls) |
@@ -102,10 +107,28 @@ template_plugin_del (void *cls) | |||
102 | 107 | ||
103 | 108 | ||
104 | /** | 109 | /** |
110 | * Return a random value from the datastore. | ||
111 | * | ||
112 | * @param cls closure (internal context for the plugin) | ||
113 | * @param iter maybe NULL (to just count) | ||
114 | * @param iter_cls closure for @a iter | ||
115 | * @return the number of results found (zero or one) | ||
116 | */ | ||
117 | static unsigned int | ||
118 | template_get_random (void *cls, | ||
119 | GNUNET_DATACACHE_Iterator iter, | ||
120 | void *iter_cls) | ||
121 | { | ||
122 | GNUNET_break (0); | ||
123 | return 0; | ||
124 | } | ||
125 | |||
126 | |||
127 | /** | ||
105 | * Entry point for the plugin. | 128 | * Entry point for the plugin. |
106 | * | 129 | * |
107 | * @param cls closure (the "struct GNUNET_DATACACHE_PluginEnvironmnet") | 130 | * @param cls closure (the `struct GNUNET_DATACACHE_PluginEnvironmnet`) |
108 | * @return the plugin's closure (our "struct Plugin") | 131 | * @return the plugin's closure (our `struct Plugin`) |
109 | */ | 132 | */ |
110 | void * | 133 | void * |
111 | libgnunet_plugin_datacache_template_init (void *cls) | 134 | libgnunet_plugin_datacache_template_init (void *cls) |
@@ -121,8 +144,10 @@ libgnunet_plugin_datacache_template_init (void *cls) | |||
121 | api->get = &template_plugin_get; | 144 | api->get = &template_plugin_get; |
122 | api->put = &template_plugin_put; | 145 | api->put = &template_plugin_put; |
123 | api->del = &template_plugin_del; | 146 | api->del = &template_plugin_del; |
124 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, "template", | 147 | api->get_random = &template_plugin_get_random; |
125 | _("Template datacache running\n")); | 148 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, |
149 | "template", | ||
150 | "Template datacache running\n"); | ||
126 | return api; | 151 | return api; |
127 | } | 152 | } |
128 | 153 | ||
@@ -130,7 +155,7 @@ libgnunet_plugin_datacache_template_init (void *cls) | |||
130 | /** | 155 | /** |
131 | * Exit point from the plugin. | 156 | * Exit point from the plugin. |
132 | * | 157 | * |
133 | * @param cls closure (our "struct Plugin") | 158 | * @param cls closure (our `struct Plugin`) |
134 | * @return NULL | 159 | * @return NULL |
135 | */ | 160 | */ |
136 | void * | 161 | void * |
@@ -145,5 +170,4 @@ libgnunet_plugin_datacache_template_done (void *cls) | |||
145 | } | 170 | } |
146 | 171 | ||
147 | 172 | ||
148 | |||
149 | /* end of plugin_datacache_template.c */ | 173 | /* end of plugin_datacache_template.c */ |