diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-04-03 15:10:41 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-04-03 15:10:41 +0000 |
commit | d2f2c8800aa6ea07a024c5511a1b1d23ad356090 (patch) | |
tree | 244c947db2921817c15d04b6a88a3f843e33d2a3 /src/datastore/plugin_datastore_template.c | |
parent | 745d6c5753f2e5f163220a376d58083b2d7ff76d (diff) | |
download | gnunet-d2f2c8800aa6ea07a024c5511a1b1d23ad356090.tar.gz gnunet-d2f2c8800aa6ea07a024c5511a1b1d23ad356090.zip |
new plugin API
Diffstat (limited to 'src/datastore/plugin_datastore_template.c')
-rw-r--r-- | src/datastore/plugin_datastore_template.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/datastore/plugin_datastore_template.c b/src/datastore/plugin_datastore_template.c index 09dfe85d9..fc67f600e 100644 --- a/src/datastore/plugin_datastore_template.c +++ b/src/datastore/plugin_datastore_template.c | |||
@@ -64,6 +64,7 @@ static unsigned long long template_plugin_get_size (void *cls) | |||
64 | * @param type type of the content | 64 | * @param type type of the content |
65 | * @param priority priority of the content | 65 | * @param priority priority of the content |
66 | * @param anonymity anonymity-level for the content | 66 | * @param anonymity anonymity-level for the content |
67 | * @param replication replication-level for the content | ||
67 | * @param expiration expiration time for the content | 68 | * @param expiration expiration time for the content |
68 | * @param msg set to error message | 69 | * @param msg set to error message |
69 | * @return GNUNET_OK on success | 70 | * @return GNUNET_OK on success |
@@ -76,6 +77,7 @@ template_plugin_put (void *cls, | |||
76 | enum GNUNET_BLOCK_Type type, | 77 | enum GNUNET_BLOCK_Type type, |
77 | uint32_t priority, | 78 | uint32_t priority, |
78 | uint32_t anonymity, | 79 | uint32_t anonymity, |
80 | uint32_t replication, | ||
79 | struct GNUNET_TIME_Absolute expiration, | 81 | struct GNUNET_TIME_Absolute expiration, |
80 | char **msg) | 82 | char **msg) |
81 | { | 83 | { |
@@ -133,6 +135,25 @@ template_plugin_get (void *cls, | |||
133 | } | 135 | } |
134 | 136 | ||
135 | 137 | ||
138 | |||
139 | /** | ||
140 | * Get a random item for replication. Returns a single, not expired, random item | ||
141 | * from those with the highest replication counters. The item's | ||
142 | * replication counter is decremented by one IF it was positive before. | ||
143 | * Call 'iter' with all values ZERO or NULL if the datastore is empty. | ||
144 | * | ||
145 | * @param cls closure | ||
146 | * @param iter function to call the value (once only). | ||
147 | * @param iter_cls closure for iter | ||
148 | */ | ||
149 | static void | ||
150 | template_plugin_replication_get (void *cls, | ||
151 | PluginIterator iter, void *iter_cls) | ||
152 | { | ||
153 | GNUNET_break (0); | ||
154 | } | ||
155 | |||
156 | |||
136 | /** | 157 | /** |
137 | * Update the priority for a particular key in the datastore. If | 158 | * Update the priority for a particular key in the datastore. If |
138 | * the expiration time in value is different than the time found in | 159 | * the expiration time in value is different than the time found in |
@@ -308,6 +329,7 @@ libgnunet_plugin_datastore_template_init (void *cls) | |||
308 | api->put = &template_plugin_put; | 329 | api->put = &template_plugin_put; |
309 | api->next_request = &template_plugin_next_request; | 330 | api->next_request = &template_plugin_next_request; |
310 | api->get = &template_plugin_get; | 331 | api->get = &template_plugin_get; |
332 | api->replication_get = &template_plugin_replication_get; | ||
311 | api->update = &template_plugin_update; | 333 | api->update = &template_plugin_update; |
312 | api->iter_low_priority = &template_plugin_iter_low_priority; | 334 | api->iter_low_priority = &template_plugin_iter_low_priority; |
313 | api->iter_zero_anonymity = &template_plugin_iter_zero_anonymity; | 335 | api->iter_zero_anonymity = &template_plugin_iter_zero_anonymity; |