aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-02-21 15:32:34 +0000
committerChristian Grothoff <christian@grothoff.org>2012-02-21 15:32:34 +0000
commit39895e8a886613dc0df246023aba2f85a0fe9071 (patch)
treead82c33a784cdb20d518d62a9f28ecfcbbe3241c /src
parentdf2725fc53449fb9cbc61e402d5124f5266743dc (diff)
downloadgnunet-39895e8a886613dc0df246023aba2f85a0fe9071.tar.gz
gnunet-39895e8a886613dc0df246023aba2f85a0fe9071.zip
-DB API updates, creating tables and preparing statements
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_namestore_plugin.h28
-rw-r--r--src/namestore/plugin_namestore_sqlite.c198
2 files changed, 184 insertions, 42 deletions
diff --git a/src/include/gnunet_namestore_plugin.h b/src/include/gnunet_namestore_plugin.h
index ecdc40f09..d19c3aeb2 100644
--- a/src/include/gnunet_namestore_plugin.h
+++ b/src/include/gnunet_namestore_plugin.h
@@ -47,8 +47,6 @@ extern "C"
47 * 47 *
48 * @param cls closure 48 * @param cls closure
49 * @param zone hash of the public key of the zone 49 * @param zone hash of the public key of the zone
50 * @param record_hash hash of the record
51 * @param record_key XOR of zone and hash of name
52 * @param name name that is being mapped (at most 255 characters long) 50 * @param name name that is being mapped (at most 255 characters long)
53 * @param record_type type of the record (A, AAAA, PKEY, etc.) 51 * @param record_type type of the record (A, AAAA, PKEY, etc.)
54 * @param expiration expiration time for the content 52 * @param expiration expiration time for the content
@@ -59,8 +57,6 @@ extern "C"
59 */ 57 */
60typedef void (*GNUNET_NAMESTORE_RecordIterator) (void *cls, 58typedef void (*GNUNET_NAMESTORE_RecordIterator) (void *cls,
61 const GNUNET_HashCode *zone, 59 const GNUNET_HashCode *zone,
62 const GNUNET_HashCode *record_hash,
63 const GNUNET_HashCode *record_key,
64 const char *name, 60 const char *name,
65 uint32_t record_type, 61 uint32_t record_type,
66 struct GNUNET_TIME_Absolute expiration, 62 struct GNUNET_TIME_Absolute expiration,
@@ -94,13 +90,15 @@ typedef void (*GNUNET_NAMESTORE_NodeCallback) (void *cls,
94 * @param cls closure 90 * @param cls closure
95 * @param zone public key of the zone 91 * @param zone public key of the zone
96 * @param loc location of the root in the B-tree (depth, revision) 92 * @param loc location of the root in the B-tree (depth, revision)
97 * @param top_sig 93 * @param top_sig signature signing the zone
94 * @param zone_time time the signature was created
98 * @param root_hash top level hash that is being signed 95 * @param root_hash top level hash that is being signed
99 */ 96 */
100typedef void (*GNUNET_NAMESTORE_SignatureCallback) (void *cls, 97typedef void (*GNUNET_NAMESTORE_SignatureCallback) (void *cls,
101 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, 98 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key,
102 const struct GNUNET_NAMESTORE_SignatureLocation *loc, 99 const struct GNUNET_NAMESTORE_SignatureLocation *loc,
103 const struct GNUNET_CRYPTO_RsaSignature *top_sig, 100 const struct GNUNET_CRYPTO_RsaSignature *top_sig,
101 struct GNUNET_TIME_Absolute zone_time,
104 const GNUNET_HashCode *root_hash); 102 const GNUNET_HashCode *root_hash);
105 103
106 104
@@ -120,10 +118,9 @@ struct GNUNET_NAMESTORE_PluginFunctions
120 * 118 *
121 * @param cls closure (internal context for the plugin) 119 * @param cls closure (internal context for the plugin)
122 * @param zone hash of the public key of the zone 120 * @param zone hash of the public key of the zone
123 * @param record_hash hash of the record
124 * @param record_key XOR of zone and hash of name
125 * @param name name that is being mapped (at most 255 characters long) 121 * @param name name that is being mapped (at most 255 characters long)
126 * @param record_type type of the record (A, AAAA, PKEY, etc.) 122 * @param record_type type of the record (A, AAAA, PKEY, etc.)
123 * @param loc location of the signature for the record
127 * @param expiration expiration time for the content 124 * @param expiration expiration time for the content
128 * @param flags flags for the content 125 * @param flags flags for the content
129 * @param data_size number of bytes in data 126 * @param data_size number of bytes in data
@@ -133,10 +130,9 @@ struct GNUNET_NAMESTORE_PluginFunctions
133 */ 130 */
134 int (*put_record) (void *cls, 131 int (*put_record) (void *cls,
135 const GNUNET_HashCode *zone, 132 const GNUNET_HashCode *zone,
136 const GNUNET_HashCode *record_hash,
137 const GNUNET_HashCode *record_key,
138 const char *name, 133 const char *name,
139 uint32_t record_type, 134 uint32_t record_type,
135 const struct GNUNET_NAMESTORE_SignatureLocation *loc,
140 struct GNUNET_TIME_Absolute expiration, 136 struct GNUNET_TIME_Absolute expiration,
141 enum GNUNET_NAMESTORE_RecordFlags flags, 137 enum GNUNET_NAMESTORE_RecordFlags flags,
142 size_t data_size, 138 size_t data_size,
@@ -149,7 +145,8 @@ struct GNUNET_NAMESTORE_PluginFunctions
149 * @param cls closure (internal context for the plugin) 145 * @param cls closure (internal context for the plugin)
150 * @param zone hash of public key of the zone 146 * @param zone hash of public key of the zone
151 * @param loc location in the B-tree 147 * @param loc location in the B-tree
152 * @param ploc parent's location in the B-tree (must have depth = loc.depth - 1), NULL for root 148 * @param ploc parent's location in the B-tree (must have depth = loc.depth - 1) and the
149 * revision must also match loc's revision; NULL for root
153 * @param num_entries number of entries at this node in the B-tree 150 * @param num_entries number of entries at this node in the B-tree
154 * @param entries the 'num_entries' entries to store (hashes over the 151 * @param entries the 'num_entries' entries to store (hashes over the
155 * records) 152 * records)
@@ -172,15 +169,17 @@ struct GNUNET_NAMESTORE_PluginFunctions
172 * @param cls closure (internal context for the plugin) 169 * @param cls closure (internal context for the plugin)
173 * @param zone_key public key of the zone 170 * @param zone_key public key of the zone
174 * @param loc location in the B-tree (top of the tree, offset 0, depth at 'maximum') 171 * @param loc location in the B-tree (top of the tree, offset 0, depth at 'maximum')
175 * @param top_sig signature at the top, NULL if 'loc.depth > 0' 172 * @param top_sig signature at the top
176 * @param root_hash top level hash that is signed 173 * @param root_hash top level hash that is signed
174 * @param zone_time time the zone was signed
177 * @return GNUNET_OK on success 175 * @return GNUNET_OK on success
178 */ 176 */
179 int (*put_signature) (void *cls, 177 int (*put_signature) (void *cls,
180 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, 178 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key,
181 const struct GNUNET_NAMESTORE_SignatureLocation *loc, 179 const struct GNUNET_NAMESTORE_SignatureLocation *loc,
182 const struct GNUNET_CRYPTO_RsaSignature *top_sig, 180 const struct GNUNET_CRYPTO_RsaSignature *top_sig,
183 const GNUNET_HashCode *root_hash); 181 const GNUNET_HashCode *root_hash,
182 struct GNUNET_TIME_Absolute zone_time);
184 183
185 184
186 /** 185 /**
@@ -191,15 +190,14 @@ struct GNUNET_NAMESTORE_PluginFunctions
191 * 190 *
192 * @param cls closure (internal context for the plugin) 191 * @param cls closure (internal context for the plugin)
193 * @param zone hash of public key of the zone 192 * @param zone hash of public key of the zone
194 * @param record_key key for the record (XOR of zone and hash of name); 193 * @param name_hash hash of name, NULL to iterate over all records of the zone
195 * NULL to iterate over all records of the zone
196 * @param iter maybe NULL (to just count) 194 * @param iter maybe NULL (to just count)
197 * @param iter_cls closure for iter 195 * @param iter_cls closure for iter
198 * @return the number of results found 196 * @return the number of results found
199 */ 197 */
200 unsigned int (*iterate_records) (void *cls, 198 unsigned int (*iterate_records) (void *cls,
201 const GNUNET_HashCode *zone, 199 const GNUNET_HashCode *zone,
202 const GNUNET_HashCode *record_key, 200 const GNUNET_HashCode *name_hash,
203 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls); 201 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls);
204 202
205 203
diff --git a/src/namestore/plugin_namestore_sqlite.c b/src/namestore/plugin_namestore_sqlite.c
index 9acece9b9..bb51f093c 100644
--- a/src/namestore/plugin_namestore_sqlite.c
+++ b/src/namestore/plugin_namestore_sqlite.c
@@ -29,6 +29,19 @@
29#include <sqlite3.h> 29#include <sqlite3.h>
30 30
31/** 31/**
32 * After how many ms "busy" should a DB operation fail for good?
33 * A low value makes sure that we are more responsive to requests
34 * (especially PUTs). A high value guarantees a higher success
35 * rate (SELECTs in iterate can take several seconds despite LIMIT=1).
36 *
37 * The default value of 1s should ensure that users do not experience
38 * huge latencies while at the same time allowing operations to succeed
39 * with reasonable probability.
40 */
41#define BUSY_TIMEOUT_MS 1000
42
43
44/**
32 * Log an error message at log-level 'level' that indicates 45 * Log an error message at log-level 'level' that indicates
33 * a failure of the command 'cmd' on file 'filename' 46 * a failure of the command 'cmd' on file 'filename'
34 * with the message given by strerror(errno). 47 * with the message given by strerror(errno).
@@ -89,12 +102,17 @@ struct Plugin
89 /** 102 /**
90 * Precompiled SQL for delete zone 103 * Precompiled SQL for delete zone
91 */ 104 */
92 sqlite3_stmt *delete_zone; 105 sqlite3_stmt *delete_zone_records;
93 106
94 /** 107 /**
95 * Precompiled SQL for deleting old zone in 'put_signature' 108 * Precompiled SQL for delete zone
96 */ 109 */
97 sqlite3_stmt *delete_old_zone; 110 sqlite3_stmt *delete_zone_nodes;
111
112 /**
113 * Precompiled SQL for delete zone
114 */
115 sqlite3_stmt *delete_zone_signatures;
98 116
99}; 117};
100 118
@@ -132,7 +150,21 @@ create_indices (sqlite3 * dbh)
132{ 150{
133 /* create indices */ 151 /* create indices */
134 if (SQLITE_OK != 152 if (SQLITE_OK !=
135 sqlite3_exec (dbh, "CREATE INDEX IF NOT EXISTS idx_hash ON ns090 (hash)", 153 sqlite3_exec (dbh, "CREATE INDEX IF NOT EXISTS ir_zone_name_hash ON ns090records (zone_hash,record_name_hash)",
154 NULL, NULL, NULL))
155 LOG (GNUNET_ERROR_TYPE_ERROR,
156 "Failed to create indices: %s\n", sqlite3_errmsg (dbh));
157
158
159 if (SQLITE_OK !=
160 sqlite3_exec (dbh, "CREATE INDEX IF NOT EXISTS in_zone_location ON ns090nodes (zone_hash,zone_revision,node_location_depth,node_location_offset DESC)",
161 NULL, NULL, NULL))
162 LOG (GNUNET_ERROR_TYPE_ERROR,
163 "Failed to create indices: %s\n", sqlite3_errmsg (dbh));
164
165
166 if (SQLITE_OK !=
167 sqlite3_exec (dbh, "CREATE INDEX IF NOT EXISTS is_zone ON ns090signatures (zone_hash)",
136 NULL, NULL, NULL)) 168 NULL, NULL, NULL))
137 LOG (GNUNET_ERROR_TYPE_ERROR, 169 LOG (GNUNET_ERROR_TYPE_ERROR,
138 "Failed to create indices: %s\n", sqlite3_errmsg (dbh)); 170 "Failed to create indices: %s\n", sqlite3_errmsg (dbh));
@@ -204,7 +236,7 @@ database_setup (struct Plugin *plugin)
204 sqlite3_exec (plugin->dbh, "PRAGMA temp_store=MEMORY", NULL, NULL, 236 sqlite3_exec (plugin->dbh, "PRAGMA temp_store=MEMORY", NULL, NULL,
205 ENULL)); 237 ENULL));
206 CHECK (SQLITE_OK == 238 CHECK (SQLITE_OK ==
207 sqlite3_exec (plugin->dbh, "PRAGMA synchronous=OFF", NULL, NULL, 239 sqlite3_exec (plugin->dbh, "PRAGMA synchronous=NORMAL", NULL, NULL,
208 ENULL)); 240 ENULL));
209 CHECK (SQLITE_OK == 241 CHECK (SQLITE_OK ==
210 sqlite3_exec (plugin->dbh, "PRAGMA legacy_file_format=OFF", NULL, NULL, 242 sqlite3_exec (plugin->dbh, "PRAGMA legacy_file_format=OFF", NULL, NULL,
@@ -222,36 +254,134 @@ database_setup (struct Plugin *plugin)
222 sqlite3_exec (plugin->dbh, "PRAGMA page_size=4092", NULL, NULL, 254 sqlite3_exec (plugin->dbh, "PRAGMA page_size=4092", NULL, NULL,
223 ENULL)); 255 ENULL));
224 256
225 // CHECK (SQLITE_OK == sqlite3_busy_timeout (plugin->dbh, BUSY_TIMEOUT_MS)); ? 257 CHECK (SQLITE_OK == sqlite3_busy_timeout (plugin->dbh, BUSY_TIMEOUT_MS));
258
259
260 /* Create tables */
261 CHECK (SQLITE_OK ==
262 sq_prepare (plugin->dbh,
263 "SELECT 1 FROM sqlite_master WHERE tbl_name = 'ns090records'",
264 &stmt));
265 if ((sqlite3_step (stmt) == SQLITE_DONE) &&
266 (sqlite3_exec
267 (plugin->dbh,
268 "CREATE TABLE ns090records ("
269 " zone_hash TEXT NOT NULL DEFAULT '',"
270 " zone_revision INT4 NOT NULL DEFAULT 0,"
271 " record_name_hash TEXT NOT NULL DEFAULT '',"
272 " record_name TEXT NOT NULL DEFAULT '',"
273 " record_type INT4 NOT NULL DEFAULT 0,"
274 " node_location_depth INT4 NOT NULL DEFAULT 0,"
275 " node_location_offset INT8 NOT NULL DEFAULT 0,"
276 " record_expiration_time INT8 NOT NULL DEFAULT 0,"
277 " record_flags INT4 NOT NULL DEFAULT 0,"
278 " record_value BLOB NOT NULL DEFAULT ''"
279 ")",
280 NULL, NULL, NULL) != SQLITE_OK))
281 {
282 LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR, "sqlite3_exec");
283 sqlite3_finalize (stmt);
284 return GNUNET_SYSERR;
285 }
286 sqlite3_finalize (stmt);
287
288 CHECK (SQLITE_OK ==
289 sq_prepare (plugin->dbh,
290 "SELECT 1 FROM sqlite_master WHERE tbl_name = 'ns090nodes'",
291 &stmt));
292 if ((sqlite3_step (stmt) == SQLITE_DONE) &&
293 (sqlite3_exec
294 (plugin->dbh,
295 "CREATE TABLE ns090nodes ("
296 " zone_hash TEXT NOT NULL DEFAULT '',"
297 " zone_revision INT4 NOT NULL DEFAULT 0,"
298 " node_location_depth INT4 NOT NULL DEFAULT 0,"
299 " node_location_offset INT8 NOT NULL DEFAULT 0,"
300 " node_parent_offset INT8 NOT NULL DEFAULT 0,"
301 " node_hashcodes BLOB NOT NULL DEFAULT ''"
302 ")",
303 NULL, NULL, NULL) != SQLITE_OK))
304 {
305 LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR, "sqlite3_exec");
306 sqlite3_finalize (stmt);
307 return GNUNET_SYSERR;
308 }
309 sqlite3_finalize (stmt);
226 310
227 311
228 /* We have to do it here, because otherwise precompiling SQL might fail */
229 CHECK (SQLITE_OK == 312 CHECK (SQLITE_OK ==
230 sq_prepare (plugin->dbh, 313 sq_prepare (plugin->dbh,
231 "SELECT 1 FROM sqlite_master WHERE tbl_name = 'ns090'", 314 "SELECT 1 FROM sqlite_master WHERE tbl_name = 'ns090signatures'",
232 &stmt)); 315 &stmt));
233 if ((sqlite3_step (stmt) == SQLITE_DONE) && 316 if ((sqlite3_step (stmt) == SQLITE_DONE) &&
234 (sqlite3_exec 317 (sqlite3_exec
235 (plugin->dbh, 318 (plugin->dbh,
236 "CREATE TABLE ns090 (" " repl INT4 NOT NULL DEFAULT 0," 319 "CREATE TABLE ns090signatures ("
237 " type INT4 NOT NULL DEFAULT 0," " prio INT4 NOT NULL DEFAULT 0," 320 " zone_hash TEXT NOT NULL DEFAULT '',"
238 " anonLevel INT4 NOT NULL DEFAULT 0," 321 " zone_revision INT4 NOT NULL DEFAULT 0,"
239 " expire INT8 NOT NULL DEFAULT 0," " rvalue INT8 NOT NULL," 322 " zone_time INT8 NOT NULL DEFAULT 0,"
240 " hash TEXT NOT NULL DEFAULT ''," " vhash TEXT NOT NULL DEFAULT ''," 323 " zone_root_hash TEXT NOT NULL DEFAULT 0,"
241 " value BLOB NOT NULL DEFAULT '')", NULL, NULL, NULL) != SQLITE_OK)) 324 " zone_root_depth INT4 NOT NULL DEFAULT 0,"
325 " zone_public_key BLOB NOT NULL DEFAULT 0,"
326 " zone_signature BLOB NOT NULL DEFAULT 0"
327 ")",
328 NULL, NULL, NULL) != SQLITE_OK))
242 { 329 {
243 LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR, "sqlite3_exec"); 330 LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR, "sqlite3_exec");
244 sqlite3_finalize (stmt); 331 sqlite3_finalize (stmt);
245 return GNUNET_SYSERR; 332 return GNUNET_SYSERR;
246 } 333 }
247 sqlite3_finalize (stmt); 334 sqlite3_finalize (stmt);
335
336
248 create_indices (plugin->dbh); 337 create_indices (plugin->dbh);
249 338
250 if ((sq_prepare 339 if ((sq_prepare
251 (plugin->dbh, 340 (plugin->dbh,
252 "UPDATE gn090 " 341 "INSERT INTO ns090records (zone_hash, zone_revision, record_name_hash, record_name, "
253 "SET prio = prio + ?, expire = MAX(expire,?) WHERE _ROWID_ = ?", 342 "record_type, node_location_depth, node_location_offset, "
254 &plugin->put_record) != SQLITE_OK) ) 343 "record_expiration_time, record_flags, record_value) VALUES "
344 "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
345 &plugin->put_record) != SQLITE_OK) ||
346 (sq_prepare
347 (plugin->dbh,
348 "INSERT INTO ns090nodes (zone_hash, zone_revision, "
349 "node_location_depth, node_location_offset, node_parent_offset, node_hashcodes) "
350 "VALUES (?, ?, ?, ?, ?, ?)",
351 &plugin->put_node) != SQLITE_OK) ||
352 (sq_prepare
353 (plugin->dbh,
354 "INSERT INTO ns090signatures (zone_hash, zone_revision, zone_time, zone_root_hash, "
355 "zone_root_depth, zone_public_key, zone_signature) "
356 "VALUES (?, ?, ?, ?, ?, ?)",
357 &plugin->put_signature) != SQLITE_OK) ||
358 (sq_prepare
359 (plugin->dbh,
360 "SELECT zone_revision,record_name,record_type,node_location_depth,node_location_offset,record_expiration_time,record_flags,record_value "
361 "FROM ns090records WHERE zone_hash=? AND record_name_hash=?",
362 &plugin->iterate_records) != SQLITE_OK) ||
363 (sq_prepare
364 (plugin->dbh,
365 "SELECT node_parent_offset,node_hashcodes FROM ns090nodes "
366 "WHERE zone_hash=? AND zone_revision=? AND node_location_depth=? AND node_location_offset<=? ORDER BY node_location_offset DESC LIMIT 1",
367 &plugin->get_node) != SQLITE_OK) ||
368 (sq_prepare
369 (plugin->dbh,
370 "SELECT zone_revision,zone_time,zone_root_hash,zone_root_depth,zone_public_key,zone_signature "
371 "FROM ns090signatures WHERE zone_hash=?",
372 &plugin->get_signature) != SQLITE_OK) ||
373 (sq_prepare
374 (plugin->dbh,
375 "DELETE FROM gn090records WHERE zone_hash=?",
376 &plugin->delete_zone_records) != SQLITE_OK) ||
377 (sq_prepare
378 (plugin->dbh,
379 "DELETE FROM gn090nodes WHERE zone_hash=?",
380 &plugin->delete_zone_nodes) != SQLITE_OK) ||
381 (sq_prepare
382 (plugin->dbh,
383 "DELETE FROM gn090signatures WHERE zone_hash=?",
384 &plugin->delete_zone_signatures) != SQLITE_OK) )
255 { 385 {
256 LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR, "precompiling"); 386 LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR, "precompiling");
257 return GNUNET_SYSERR; 387 return GNUNET_SYSERR;
@@ -271,9 +401,24 @@ database_shutdown (struct Plugin *plugin)
271 int result; 401 int result;
272 sqlite3_stmt *stmt; 402 sqlite3_stmt *stmt;
273 403
274 if (plugin->put_record != NULL) 404 if (NULL != plugin->put_record)
275 sqlite3_finalize (plugin->put_record); 405 sqlite3_finalize (plugin->put_record);
276 406 if (NULL != plugin->put_node)
407 sqlite3_finalize (plugin->put_node);
408 if (NULL != plugin->put_signature)
409 sqlite3_finalize (plugin->put_signature);
410 if (NULL != plugin->iterate_records)
411 sqlite3_finalize (plugin->iterate_records);
412 if (NULL != plugin->get_node)
413 sqlite3_finalize (plugin->get_node);
414 if (NULL != plugin->get_signature)
415 sqlite3_finalize (plugin->get_signature);
416 if (NULL != plugin->delete_zone_records)
417 sqlite3_finalize (plugin->delete_zone_records);
418 if (NULL != plugin->delete_zone_nodes)
419 sqlite3_finalize (plugin->delete_zone_nodes);
420 if (NULL != plugin->delete_zone_signatures)
421 sqlite3_finalize (plugin->delete_zone_signatures);
277 result = sqlite3_close (plugin->dbh); 422 result = sqlite3_close (plugin->dbh);
278 if (result == SQLITE_BUSY) 423 if (result == SQLITE_BUSY)
279 { 424 {
@@ -304,10 +449,9 @@ database_shutdown (struct Plugin *plugin)
304 * 449 *
305 * @param cls closure (internal context for the plugin) 450 * @param cls closure (internal context for the plugin)
306 * @param zone hash of the public key of the zone 451 * @param zone hash of the public key of the zone
307 * @param record_hash hash of the record
308 * @param record_key XOR of zone and hash of name
309 * @param name name that is being mapped (at most 255 characters long) 452 * @param name name that is being mapped (at most 255 characters long)
310 * @param record_type type of the record (A, AAAA, PKEY, etc.) 453 * @param record_type type of the record (A, AAAA, PKEY, etc.)
454 * @param loc location of the signature for the record
311 * @param expiration expiration time for the content 455 * @param expiration expiration time for the content
312 * @param flags flags for the content 456 * @param flags flags for the content
313 * @param data_size number of bytes in data 457 * @param data_size number of bytes in data
@@ -318,10 +462,9 @@ database_shutdown (struct Plugin *plugin)
318static int 462static int
319namestore_sqlite_put_record (void *cls, 463namestore_sqlite_put_record (void *cls,
320 const GNUNET_HashCode *zone, 464 const GNUNET_HashCode *zone,
321 const GNUNET_HashCode *record_hash,
322 const GNUNET_HashCode *record_key,
323 const char *name, 465 const char *name,
324 uint32_t record_type, 466 uint32_t record_type,
467 const struct GNUNET_NAMESTORE_SignatureLocation *loc,
325 struct GNUNET_TIME_Absolute expiration, 468 struct GNUNET_TIME_Absolute expiration,
326 enum GNUNET_NAMESTORE_RecordFlags flags, 469 enum GNUNET_NAMESTORE_RecordFlags flags,
327 size_t data_size, 470 size_t data_size,
@@ -402,6 +545,7 @@ namestore_sqlite_put_node (void *cls,
402 * @param loc location in the B-tree (top of the tree, offset 0, depth at 'maximum') 545 * @param loc location in the B-tree (top of the tree, offset 0, depth at 'maximum')
403 * @param top_sig signature at the top, NULL if 'loc.depth > 0' 546 * @param top_sig signature at the top, NULL if 'loc.depth > 0'
404 * @param root_hash top level hash that is signed 547 * @param root_hash top level hash that is signed
548 * @param zone_time time the zone was signed
405 * @return GNUNET_OK on success 549 * @return GNUNET_OK on success
406 */ 550 */
407static int 551static int
@@ -409,7 +553,8 @@ namestore_sqlite_put_signature (void *cls,
409 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, 553 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key,
410 const struct GNUNET_NAMESTORE_SignatureLocation *loc, 554 const struct GNUNET_NAMESTORE_SignatureLocation *loc,
411 const struct GNUNET_CRYPTO_RsaSignature *top_sig, 555 const struct GNUNET_CRYPTO_RsaSignature *top_sig,
412 const GNUNET_HashCode *root_hash) 556 const GNUNET_HashCode *root_hash,
557 struct GNUNET_TIME_Absolute zone_time)
413{ 558{
414 return GNUNET_SYSERR; 559 return GNUNET_SYSERR;
415} 560}
@@ -423,8 +568,7 @@ namestore_sqlite_put_signature (void *cls,
423 * 568 *
424 * @param cls closure (internal context for the plugin) 569 * @param cls closure (internal context for the plugin)
425 * @param zone hash of public key of the zone 570 * @param zone hash of public key of the zone
426 * @param record_key key for the record (XOR of zone and hash of name); 571 * @param name_hash hash of name, NULL to iterate over all records of the zone
427 * NULL to iterate over all records of the zone
428 * @param iter maybe NULL (to just count) 572 * @param iter maybe NULL (to just count)
429 * @param iter_cls closure for iter 573 * @param iter_cls closure for iter
430 * @return the number of results found 574 * @return the number of results found
@@ -432,7 +576,7 @@ namestore_sqlite_put_signature (void *cls,
432static unsigned int 576static unsigned int
433namestore_sqlite_iterate_records (void *cls, 577namestore_sqlite_iterate_records (void *cls,
434 const GNUNET_HashCode *zone, 578 const GNUNET_HashCode *zone,
435 const GNUNET_HashCode *record_key, 579 const GNUNET_HashCode *name_hash,
436 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) 580 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
437{ 581{
438#if 0 582#if 0