diff options
Diffstat (limited to 'src/datastore/plugin_datastore_template.c')
-rw-r--r-- | src/datastore/plugin_datastore_template.c | 119 |
1 files changed, 59 insertions, 60 deletions
diff --git a/src/datastore/plugin_datastore_template.c b/src/datastore/plugin_datastore_template.c index d2e42a170..dea6151ad 100644 --- a/src/datastore/plugin_datastore_template.c +++ b/src/datastore/plugin_datastore_template.c | |||
@@ -11,12 +11,12 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file datastore/plugin_datastore_template.c | 22 | * @file datastore/plugin_datastore_template.c |
@@ -31,8 +31,7 @@ | |||
31 | /** | 31 | /** |
32 | * Context for all functions in this plugin. | 32 | * Context for all functions in this plugin. |
33 | */ | 33 | */ |
34 | struct Plugin | 34 | struct Plugin { |
35 | { | ||
36 | /** | 35 | /** |
37 | * Our execution environment. | 36 | * Our execution environment. |
38 | */ | 37 | */ |
@@ -48,11 +47,11 @@ struct Plugin | |||
48 | * @return number of bytes used on disk | 47 | * @return number of bytes used on disk |
49 | */ | 48 | */ |
50 | static void | 49 | static void |
51 | template_plugin_estimate_size (void *cls, unsigned long long *estimate) | 50 | template_plugin_estimate_size(void *cls, unsigned long long *estimate) |
52 | { | 51 | { |
53 | if (NULL == estimate) | 52 | if (NULL == estimate) |
54 | return; | 53 | return; |
55 | GNUNET_break (0); | 54 | GNUNET_break(0); |
56 | *estimate = 0; | 55 | *estimate = 0; |
57 | } | 56 | } |
58 | 57 | ||
@@ -74,21 +73,21 @@ template_plugin_estimate_size (void *cls, unsigned long long *estimate) | |||
74 | * @param cont_cls continuation closure | 73 | * @param cont_cls continuation closure |
75 | */ | 74 | */ |
76 | static void | 75 | static void |
77 | template_plugin_put (void *cls, | 76 | template_plugin_put(void *cls, |
78 | const struct GNUNET_HashCode *key, | 77 | const struct GNUNET_HashCode *key, |
79 | bool absent, | 78 | bool absent, |
80 | uint32_t size, | 79 | uint32_t size, |
81 | const void *data, | 80 | const void *data, |
82 | enum GNUNET_BLOCK_Type type, | 81 | enum GNUNET_BLOCK_Type type, |
83 | uint32_t priority, | 82 | uint32_t priority, |
84 | uint32_t anonymity, | 83 | uint32_t anonymity, |
85 | uint32_t replication, | 84 | uint32_t replication, |
86 | struct GNUNET_TIME_Absolute expiration, | 85 | struct GNUNET_TIME_Absolute expiration, |
87 | PluginPutCont cont, | 86 | PluginPutCont cont, |
88 | void *cont_cls) | 87 | void *cont_cls) |
89 | { | 88 | { |
90 | GNUNET_break (0); | 89 | GNUNET_break(0); |
91 | cont (cont_cls, key, size, GNUNET_SYSERR, "not implemented"); | 90 | cont(cont_cls, key, size, GNUNET_SYSERR, "not implemented"); |
92 | } | 91 | } |
93 | 92 | ||
94 | 93 | ||
@@ -106,15 +105,15 @@ template_plugin_put (void *cls, | |||
106 | * @param proc_cls closure for proc | 105 | * @param proc_cls closure for proc |
107 | */ | 106 | */ |
108 | static void | 107 | static void |
109 | template_plugin_get_key (void *cls, | 108 | template_plugin_get_key(void *cls, |
110 | uint64_t next_uid, | 109 | uint64_t next_uid, |
111 | bool random, | 110 | bool random, |
112 | const struct GNUNET_HashCode *key, | 111 | const struct GNUNET_HashCode *key, |
113 | enum GNUNET_BLOCK_Type type, | 112 | enum GNUNET_BLOCK_Type type, |
114 | PluginDatumProcessor proc, | 113 | PluginDatumProcessor proc, |
115 | void *proc_cls) | 114 | void *proc_cls) |
116 | { | 115 | { |
117 | GNUNET_break (0); | 116 | GNUNET_break(0); |
118 | } | 117 | } |
119 | 118 | ||
120 | 119 | ||
@@ -131,10 +130,10 @@ template_plugin_get_key (void *cls, | |||
131 | * @param proc_cls closure for proc | 130 | * @param proc_cls closure for proc |
132 | */ | 131 | */ |
133 | static void | 132 | static void |
134 | template_plugin_get_replication (void *cls, PluginDatumProcessor proc, | 133 | template_plugin_get_replication(void *cls, PluginDatumProcessor proc, |
135 | void *proc_cls) | 134 | void *proc_cls) |
136 | { | 135 | { |
137 | GNUNET_break (0); | 136 | GNUNET_break(0); |
138 | } | 137 | } |
139 | 138 | ||
140 | 139 | ||
@@ -147,10 +146,10 @@ template_plugin_get_replication (void *cls, PluginDatumProcessor proc, | |||
147 | * @param proc_cls closure for proc | 146 | * @param proc_cls closure for proc |
148 | */ | 147 | */ |
149 | static void | 148 | static void |
150 | template_plugin_get_expiration (void *cls, PluginDatumProcessor proc, | 149 | template_plugin_get_expiration(void *cls, PluginDatumProcessor proc, |
151 | void *proc_cls) | 150 | void *proc_cls) |
152 | { | 151 | { |
153 | GNUNET_break (0); | 152 | GNUNET_break(0); |
154 | } | 153 | } |
155 | 154 | ||
156 | 155 | ||
@@ -166,11 +165,11 @@ template_plugin_get_expiration (void *cls, PluginDatumProcessor proc, | |||
166 | * @param proc_cls closure for proc | 165 | * @param proc_cls closure for proc |
167 | */ | 166 | */ |
168 | static void | 167 | static void |
169 | template_plugin_get_zero_anonymity (void *cls, uint64_t next_uid, | 168 | template_plugin_get_zero_anonymity(void *cls, uint64_t next_uid, |
170 | enum GNUNET_BLOCK_Type type, | 169 | enum GNUNET_BLOCK_Type type, |
171 | PluginDatumProcessor proc, void *proc_cls) | 170 | PluginDatumProcessor proc, void *proc_cls) |
172 | { | 171 | { |
173 | GNUNET_break (0); | 172 | GNUNET_break(0); |
174 | } | 173 | } |
175 | 174 | ||
176 | 175 | ||
@@ -178,9 +177,9 @@ template_plugin_get_zero_anonymity (void *cls, uint64_t next_uid, | |||
178 | * Drop database. | 177 | * Drop database. |
179 | */ | 178 | */ |
180 | static void | 179 | static void |
181 | template_plugin_drop (void *cls) | 180 | template_plugin_drop(void *cls) |
182 | { | 181 | { |
183 | GNUNET_break (0); | 182 | GNUNET_break(0); |
184 | } | 183 | } |
185 | 184 | ||
186 | 185 | ||
@@ -192,11 +191,11 @@ template_plugin_drop (void *cls) | |||
192 | * @param proc_cls closure for proc | 191 | * @param proc_cls closure for proc |
193 | */ | 192 | */ |
194 | static void | 193 | static void |
195 | template_get_keys (void *cls, | 194 | template_get_keys(void *cls, |
196 | PluginKeyProcessor proc, | 195 | PluginKeyProcessor proc, |
197 | void *proc_cls) | 196 | void *proc_cls) |
198 | { | 197 | { |
199 | proc (proc_cls, NULL, 0); | 198 | proc(proc_cls, NULL, 0); |
200 | } | 199 | } |
201 | 200 | ||
202 | 201 | ||
@@ -211,15 +210,15 @@ template_get_keys (void *cls, | |||
211 | * @param cont_cls continuation closure for @a cont | 210 | * @param cont_cls continuation closure for @a cont |
212 | */ | 211 | */ |
213 | static void | 212 | static void |
214 | template_plugin_remove_key (void *cls, | 213 | template_plugin_remove_key(void *cls, |
215 | const struct GNUNET_HashCode *key, | 214 | const struct GNUNET_HashCode *key, |
216 | uint32_t size, | 215 | uint32_t size, |
217 | const void *data, | 216 | const void *data, |
218 | PluginRemoveCont cont, | 217 | PluginRemoveCont cont, |
219 | void *cont_cls) | 218 | void *cont_cls) |
220 | { | 219 | { |
221 | GNUNET_break (0); | 220 | GNUNET_break(0); |
222 | cont (cont_cls, key, size, GNUNET_SYSERR, "not implemented"); | 221 | cont(cont_cls, key, size, GNUNET_SYSERR, "not implemented"); |
223 | } | 222 | } |
224 | 223 | ||
225 | 224 | ||
@@ -230,15 +229,15 @@ template_plugin_remove_key (void *cls, | |||
230 | * @return our "struct Plugin*" | 229 | * @return our "struct Plugin*" |
231 | */ | 230 | */ |
232 | void * | 231 | void * |
233 | libgnunet_plugin_datastore_template_init (void *cls) | 232 | libgnunet_plugin_datastore_template_init(void *cls) |
234 | { | 233 | { |
235 | struct GNUNET_DATASTORE_PluginEnvironment *env = cls; | 234 | struct GNUNET_DATASTORE_PluginEnvironment *env = cls; |
236 | struct GNUNET_DATASTORE_PluginFunctions *api; | 235 | struct GNUNET_DATASTORE_PluginFunctions *api; |
237 | struct Plugin *plugin; | 236 | struct Plugin *plugin; |
238 | 237 | ||
239 | plugin = GNUNET_new (struct Plugin); | 238 | plugin = GNUNET_new(struct Plugin); |
240 | plugin->env = env; | 239 | plugin->env = env; |
241 | api = GNUNET_new (struct GNUNET_DATASTORE_PluginFunctions); | 240 | api = GNUNET_new(struct GNUNET_DATASTORE_PluginFunctions); |
242 | api->cls = plugin; | 241 | api->cls = plugin; |
243 | api->estimate_size = &template_plugin_estimate_size; | 242 | api->estimate_size = &template_plugin_estimate_size; |
244 | api->put = &template_plugin_put; | 243 | api->put = &template_plugin_put; |
@@ -249,8 +248,8 @@ libgnunet_plugin_datastore_template_init (void *cls) | |||
249 | api->drop = &template_plugin_drop; | 248 | api->drop = &template_plugin_drop; |
250 | api->get_keys = &template_get_keys; | 249 | api->get_keys = &template_get_keys; |
251 | api->remove_key = &template_plugin_remove_key; | 250 | api->remove_key = &template_plugin_remove_key; |
252 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, "template", | 251 | GNUNET_log_from(GNUNET_ERROR_TYPE_INFO, "template", |
253 | _("Template database running\n")); | 252 | _("Template database running\n")); |
254 | return api; | 253 | return api; |
255 | } | 254 | } |
256 | 255 | ||
@@ -261,13 +260,13 @@ libgnunet_plugin_datastore_template_init (void *cls) | |||
261 | * @return always NULL | 260 | * @return always NULL |
262 | */ | 261 | */ |
263 | void * | 262 | void * |
264 | libgnunet_plugin_datastore_template_done (void *cls) | 263 | libgnunet_plugin_datastore_template_done(void *cls) |
265 | { | 264 | { |
266 | struct GNUNET_DATASTORE_PluginFunctions *api = cls; | 265 | struct GNUNET_DATASTORE_PluginFunctions *api = cls; |
267 | struct Plugin *plugin = api->cls; | 266 | struct Plugin *plugin = api->cls; |
268 | 267 | ||
269 | GNUNET_free (plugin); | 268 | GNUNET_free(plugin); |
270 | GNUNET_free (api); | 269 | GNUNET_free(api); |
271 | return NULL; | 270 | return NULL; |
272 | } | 271 | } |
273 | 272 | ||