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