/*
This file is part of GNUnet
- Copyright (C) 2012, 2013 GNUnet e.V.
+ Copyright (C) 2012, 2013, 2018 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
* Function called for each matching record.
*
* @param cls closure
+ * @param serial unique serial number of the record
* @param zone_key private key of the zone
* @param label name that is being mapped (at most 255 characters long)
* @param rd_count number of entries in @a rd array
*/
typedef void
(*GNUNET_NAMESTORE_RecordIterator) (void *cls,
+ uint64_t serial,
const struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key,
const char *label,
unsigned int rd_count,
*
* @param cls closure (internal context for the plugin)
* @param zone private key of the zone, NULL for all zones
- * @param offset offset in the list of all matching records
+ * @param serial serial (to exclude) in the list of matching records
* @param limit maximum number of results to return to @a iter
* @param iter function to call with the result
* @param iter_cls closure for @a iter
int
(*iterate_records) (void *cls,
const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
- uint64_t offset,
+ uint64_t serial,
uint64_t limit,
GNUNET_NAMESTORE_RecordIterator iter,
void *iter_cls);
char* pkey;
char* new_buf;
+ (void) zone_key;
if (1 != rd_len)
{
GNUNET_NAMESTORE_zone_iterator_next (zr->list_it,
char *reply;
struct MHD_Response *response;
+ (void) request;
GNUNET_asprintf (&reply,
SUBMIT_PAGE,
info,
struct Request *request = cls;
struct GNUNET_GNSRECORD_Data r;
+ (void) rd;
+ (void) zone_key;
request->qe = NULL;
if (0 != rd_count)
{
{
struct Request *request = cls;
+ (void) label;
+ (void) rd;
+ (void) zone;
request->qe = NULL;
if (0 == rd_count)
{
struct GNUNET_CRYPTO_EcdsaPublicKey pub;
int ret;
+ (void) cls;
+ (void) version;
if ( (0 == strcmp (method, MHD_HTTP_METHOD_GET)) ||
(0 == strcmp (method, MHD_HTTP_METHOD_HEAD)) )
{
{
(void) cls;
(void) zone;
+ (void) rd_count;
+ (void) rd;
reverse_qe = NULL;
if (NULL == label)
FPRINTF (stdout,
char *vs;
(void) cls;
+ (void) zone;
del_qe = NULL;
if (0 == rd_count)
{
{
const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
+ (void) cls;
+ (void) ctx;
+ (void) name;
if (NULL == ego)
{
get_default = GNUNET_IDENTITY_get (idh,
*/
struct GNUNET_CRYPTO_EcdsaPrivateKey zone;
+ /**
+ * Last sequence number in the zone iteration used to address next
+ * result of the zone iteration in the store
+ *
+ * Initialy set to 0.
+ * Updated in #zone_iterate_proc()
+ */
+ uint64_t seq;
+
/**
* The operation id fot the zone iteration in the response for the client
*/
struct GNUNET_SCHEDULER_Task *task;
/**
- * Offset of the zone iteration used to address next result of the zone
- * iteration in the store
+ * Last sequence number in the zone iteration used to address next
+ * result of the zone iteration in the store
*
* Initialy set to 0.
- * Incremented with by every call to #handle_iteration_next
+ * Updated in #monitor_iterate_cb()
*/
- uint32_t offset;
+ uint64_t seq;
};
* record, which (if found) is then copied to @a cls for future use.
*
* @param cls a `struct GNUNET_GNSRECORD_Data **` for storing the nick (if found)
+ * @param seq sequence number of the record
* @param private_key the private key of the zone (unused)
* @param label should be #GNUNET_GNS_EMPTY_LABEL_AT
* @param rd_count number of records in @a rd
*/
static void
lookup_nick_it (void *cls,
+ uint64_t seq,
const struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key,
const char *label,
unsigned int rd_count,
struct GNUNET_GNSRECORD_Data **res = cls;
(void) private_key;
+ (void) seq;
if (0 != strcmp (label, GNUNET_GNS_EMPTY_LABEL_AT))
{
GNUNET_break (0);
/**
* FIXME.
+ * @param seq sequence number of the record
*/
static void
lookup_it (void *cls,
+ uint64_t seq,
const struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key,
const char *label,
unsigned int rd_count,
unsigned int rdc_res;
(void) private_key;
+ (void) seq;
if (0 == strcmp (label,
rlc->label))
{
* Zone to name iterator
*
* @param cls struct ZoneToNameCtx *
+ * @param seq sequence number of the record
* @param zone_key the zone key
* @param name name
* @param rd_count number of records in @a rd
*/
static void
handle_zone_to_name_it (void *cls,
+ uint64_t seq,
const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key,
const char *name,
unsigned int rd_count,
char *name_tmp;
char *rd_tmp;
+ (void) seq;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Found result for zone-to-name lookup: `%s'\n",
name);
/**
* Process results for zone iteration from database
- *
- * @param cls struct ZoneIterationProcResult *proc
+ *
+ * @param cls struct ZoneIterationProcResult
+ * @param seq sequence number of the record
* @param zone_key the zone key
* @param name name
* @param rd_count number of records for this name
*/
static void
zone_iterate_proc (void *cls,
+ uint64_t seq,
const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key,
const char *name,
unsigned int rd_count,
return;
}
proc->limit--;
+ proc->zi->seq = seq;
send_lookup_response (proc->zi->nc,
proc->zi->request_id,
zone_key,
sizeof (zero)))
? NULL
: &zi->zone,
- zi->offset,
+ zi->seq,
limit,
&zone_iterate_proc,
&proc));
"NAMESTORE iteration delay (μs/record)",
duration.rel_value_us,
GNUNET_NO);
- zi->offset += (limit - proc.limit);
if (0 == proc.limit)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
* A #GNUNET_NAMESTORE_RecordIterator for monitors.
*
* @param cls a 'struct ZoneMonitor *' with information about the monitor
+ * @param seq sequence number of the record
* @param zone_key zone key of the zone
* @param name name
* @param rd_count number of records in @a rd
*/
static void
monitor_iterate_cb (void *cls,
+ uint64_t seq,
const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key,
const char *name,
unsigned int rd_count,
{
struct ZoneMonitor *zm = cls;
+ zm->seq = seq;
if (NULL == name)
{
/* finished with iteration */
sizeof (zero)))
? NULL
: &zm->zone,
- zm->offset++,
+ zm->seq,
1,
&monitor_iterate_cb,
zm);
"DISABLE");
GSN_cfg = cfg;
monitor_nc = GNUNET_notification_context_create (1);
- if (GNUNET_NO == disable_namecache)
+ if (GNUNET_YES != disable_namecache)
{
namecache = GNUNET_NAMECACHE_connect (cfg);
GNUNET_assert (NULL != namecache);
* Length of serialized record data
*/
uint16_t rd_len GNUNET_PACKED;
-
+
/**
* Number of records contained
*/
/**
* Was the label found in the database??
- * GNUNET_YES or GNUNET_NO
+ * #GNUNET_YES or #GNUNET_NO
*/
uint16_t found GNUNET_PACKED;
return GNUNET_NO;
if (NULL != iter)
iter (iter_cls,
+ 0,
entry->private_key,
entry->label,
entry->record_count,
*/
uint64_t limit;
+ /**
+ * What is the position of the current entry, counting
+ * starts from 1.
+ */
+ uint64_t pos;
+
/**
* Target zone.
*/
struct FlatFileEntry *entry = value;
(void) key;
+ ic->pos++;
if (0 == ic->limit)
return GNUNET_NO;
if ( (NULL != ic->zone) &&
return GNUNET_YES;
}
ic->iter (ic->iter_cls,
+ ic->pos,
entry->private_key,
entry->label,
entry->record_count,
*
* @param cls closure (internal context for the plugin)
* @param zone hash of public key of the zone, NULL to iterate over all zones
- * @param offset offset in the list of all matching records
+ * @param serial serial number to exclude in the list of all matching records
* @param limit maximum number of results to return to @a iter
* @param iter function to call with the result
* @param iter_cls closure for @a iter
static int
namestore_flat_iterate_records (void *cls,
const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
- uint64_t offset,
+ uint64_t serial,
uint64_t limit,
GNUNET_NAMESTORE_RecordIterator iter,
void *iter_cls)
struct Plugin *plugin = cls;
struct IterateContext ic;
- ic.offset = offset;
+ ic.offset = serial;
+ ic.pos = 0;
ic.limit = limit;
ic.iter = iter;
ic.iter_cls = iter_cls;
sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)))
{
plugin->iter (plugin->iter_cls,
+ 0,
entry->private_key,
entry->label,
entry->record_count,
database_setup (struct Plugin *plugin)
{
struct GNUNET_PQ_ExecuteStatement es_temporary =
- GNUNET_PQ_make_execute ("CREATE TEMPORARY TABLE IF NOT EXISTS ns097records ("
+ GNUNET_PQ_make_execute ("CREATE TEMPORARY TABLE IF NOT EXISTS ns098records ("
+ " seq BIGSERIAL PRIMARY KEY,"
" zone_private_key BYTEA NOT NULL DEFAULT '',"
" pkey BYTEA DEFAULT '',"
" rvalue BYTEA NOT NULL DEFAULT '',"
")"
"WITH OIDS");
struct GNUNET_PQ_ExecuteStatement es_default =
- GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS ns097records ("
+ GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS ns098records ("
+ " seq SERIAL PRIMARY KEY,"
" zone_private_key BYTEA NOT NULL DEFAULT '',"
" pkey BYTEA DEFAULT '',"
" rvalue BYTEA NOT NULL DEFAULT '',"
struct GNUNET_PQ_ExecuteStatement es[] = {
*cr,
GNUNET_PQ_make_try_execute ("CREATE INDEX IF NOT EXISTS ir_pkey_reverse "
- "ON ns097records (zone_private_key,pkey)"),
+ "ON ns098records (zone_private_key,pkey)"),
GNUNET_PQ_make_try_execute ("CREATE INDEX IF NOT EXISTS ir_pkey_iter "
- "ON ns097records (zone_private_key,rvalue)"),
- GNUNET_PQ_make_try_execute ("CREATE INDEX IF NOT EXISTS it_iter "
- "ON ns097records (rvalue)"),
+ "ON ns098records (zone_private_key,seq)"),
GNUNET_PQ_make_try_execute ("CREATE INDEX IF NOT EXISTS ir_label "
- "ON ns097records (label)"),
+ "ON ns098records (label)"),
GNUNET_PQ_EXECUTE_STATEMENT_END
};
{
struct GNUNET_PQ_PreparedStatement ps[] = {
GNUNET_PQ_make_prepare ("store_records",
- "INSERT INTO ns097records (zone_private_key, pkey, rvalue, record_count, record_data, label) VALUES "
+ "INSERT INTO ns098records (zone_private_key, pkey, rvalue, record_count, record_data, label) VALUES "
"($1, $2, $3, $4, $5, $6)",
6),
GNUNET_PQ_make_prepare ("delete_records",
- "DELETE FROM ns097records "
+ "DELETE FROM ns098records "
"WHERE zone_private_key=$1 AND label=$2",
2),
GNUNET_PQ_make_prepare ("zone_to_name",
- "SELECT record_count,record_data,label FROM ns097records"
+ "SELECT seq,record_count,record_data,label FROM ns098records"
" WHERE zone_private_key=$1 AND pkey=$2",
2),
GNUNET_PQ_make_prepare ("iterate_zone",
- "SELECT record_count,record_data,label FROM ns097records "
- "WHERE zone_private_key=$1 ORDER BY rvalue OFFSET $2 LIMIT $3",
+ "SELECT seq,record_count,record_data,label FROM ns098records "
+ "WHERE zone_private_key=$1 AND seq > $2 ORDER BY seq ASC LIMIT $3",
3),
GNUNET_PQ_make_prepare ("iterate_all_zones",
- "SELECT record_count,record_data,label,zone_private_key"
- " FROM ns097records ORDER BY rvalue OFFSET $1 LIMIT $2",
+ "SELECT seq,record_count,record_data,label,zone_private_key"
+ " FROM ns098records WHERE seq > $1 ORDER BY seq ASC LIMIT $2",
2),
GNUNET_PQ_make_prepare ("lookup_label",
- "SELECT record_count,record_data,label "
- "FROM ns097records WHERE zone_private_key=$1 AND label=$2",
+ "SELECT seq,record_count,record_data,label "
+ "FROM ns098records WHERE zone_private_key=$1 AND label=$2",
2),
GNUNET_PQ_PREPARED_STATEMENT_END
};
}
rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
UINT64_MAX);
- data_size = GNUNET_GNSRECORD_records_get_size (rd_count, rd);
+ data_size = GNUNET_GNSRECORD_records_get_size (rd_count,
+ rd);
if (data_size > 64 * 65536)
{
GNUNET_break (0);
return; /* no need to do more work */
for (unsigned int i=0;i<num_results;i++)
{
+ uint64_t serial;
void *data;
size_t data_size;
uint32_t record_count;
char *label;
struct GNUNET_CRYPTO_EcdsaPrivateKey zk;
struct GNUNET_PQ_ResultSpec rs_with_zone[] = {
+ GNUNET_PQ_result_spec_uint64 ("seq", &serial),
GNUNET_PQ_result_spec_uint32 ("record_count", &record_count),
GNUNET_PQ_result_spec_variable_size ("record_data", &data, &data_size),
GNUNET_PQ_result_spec_string ("label", &label),
GNUNET_PQ_result_spec_end
};
struct GNUNET_PQ_ResultSpec rs_without_zone[] = {
+ GNUNET_PQ_result_spec_uint64 ("seq", &serial),
GNUNET_PQ_result_spec_uint32 ("record_count", &record_count),
GNUNET_PQ_result_spec_variable_size ("record_data", &data, &data_size),
GNUNET_PQ_result_spec_string ("label", &label),
return;
}
pc->iter (pc->iter_cls,
+ serial,
(NULL == pc->zone_key) ? &zk : pc->zone_key,
label,
record_count,
*
* @param cls closure (internal context for the plugin)
* @param zone hash of public key of the zone, NULL to iterate over all zones
- * @param offset offset in the list of all matching records
+ * @param serial serial number to exclude in the list of all matching records
* @param limit maximum number of results to fetch
* @param iter function to call with the result
* @param iter_cls closure for @a iter
static int
namestore_postgres_iterate_records (void *cls,
const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
- uint64_t offset,
+ uint64_t serial,
uint64_t limit,
GNUNET_NAMESTORE_RecordIterator iter,
void *iter_cls)
if (NULL == zone)
{
struct GNUNET_PQ_QueryParam params_without_zone[] = {
- GNUNET_PQ_query_param_uint64 (&offset),
+ GNUNET_PQ_query_param_uint64 (&serial),
GNUNET_PQ_query_param_uint64 (&limit),
GNUNET_PQ_query_param_end
};
{
struct GNUNET_PQ_QueryParam params_with_zone[] = {
GNUNET_PQ_query_param_auto_from_type (zone),
- GNUNET_PQ_query_param_uint64 (&offset),
+ GNUNET_PQ_query_param_uint64 (&serial),
GNUNET_PQ_query_param_uint64 (&limit),
GNUNET_PQ_query_param_end
};
/* create indices */
if ( (SQLITE_OK !=
sqlite3_exec (dbh,
- "CREATE INDEX IF NOT EXISTS ir_pkey_reverse ON ns097records (zone_private_key,pkey)",
+ "CREATE INDEX IF NOT EXISTS ir_pkey_reverse "
+ "ON ns098records (zone_private_key,pkey)",
NULL, NULL, NULL)) ||
(SQLITE_OK !=
sqlite3_exec (dbh,
- "CREATE INDEX IF NOT EXISTS ir_pkey_iter ON ns097records (zone_private_key,rvalue)",
- NULL, NULL, NULL)) ||
- (SQLITE_OK !=
- sqlite3_exec (dbh,
- "CREATE INDEX IF NOT EXISTS it_iter ON ns097records (rvalue)",
+ "CREATE INDEX IF NOT EXISTS ir_pkey_iter "
+ "ON ns098records (zone_private_key,uid)",
NULL, NULL, NULL)) )
LOG (GNUNET_ERROR_TYPE_ERROR,
"Failed to create indices: %s\n",
/* Create table */
CHECK (SQLITE_OK ==
sq_prepare (plugin->dbh,
- "SELECT 1 FROM sqlite_master WHERE tbl_name = 'ns097records'",
+ "SELECT 1 FROM sqlite_master WHERE tbl_name = 'ns098records'",
&stmt));
- if ((sqlite3_step (stmt) == SQLITE_DONE) &&
- (sqlite3_exec
- (plugin->dbh,
- "CREATE TABLE ns097records ("
- " zone_private_key BLOB NOT NULL,"
- " pkey BLOB,"
- " rvalue INT8 NOT NULL,"
- " record_count INT NOT NULL,"
- " record_data BLOB NOT NULL,"
- " label TEXT NOT NULL"
- ")",
- NULL, NULL, NULL) != SQLITE_OK))
+ if ( (sqlite3_step (stmt) == SQLITE_DONE) &&
+ (SQLITE_OK !=
+ sqlite3_exec (plugin->dbh,
+ "CREATE TABLE ns098records ("
+ " uid INTEGER PRIMARY KEY,"
+ " zone_private_key BLOB NOT NULL,"
+ " pkey BLOB,"
+ " rvalue INT8 NOT NULL,"
+ " record_count INT NOT NULL,"
+ " record_data BLOB NOT NULL,"
+ " label TEXT NOT NULL"
+ ")",
+ NULL, NULL, NULL)) )
{
- LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR,
+ LOG_SQLITE (plugin,
+ GNUNET_ERROR_TYPE_ERROR,
"sqlite3_exec");
sqlite3_finalize (stmt);
return GNUNET_SYSERR;
if ( (SQLITE_OK !=
sq_prepare (plugin->dbh,
- "INSERT INTO ns097records (zone_private_key, pkey, rvalue, record_count, record_data, label)"
+ "INSERT INTO ns098records (zone_private_key, pkey, rvalue, record_count, record_data, label)"
" VALUES (?, ?, ?, ?, ?, ?)",
&plugin->store_records)) ||
(SQLITE_OK !=
sq_prepare (plugin->dbh,
- "DELETE FROM ns097records WHERE zone_private_key=? AND label=?",
+ "DELETE FROM ns098records WHERE zone_private_key=? AND label=?",
&plugin->delete_records)) ||
(SQLITE_OK !=
sq_prepare (plugin->dbh,
- "SELECT record_count,record_data,label"
- " FROM ns097records WHERE zone_private_key=? AND pkey=?",
+ "SELECT uid,record_count,record_data,label"
+ " FROM ns098records"
+ " WHERE zone_private_key=? AND pkey=?",
&plugin->zone_to_name)) ||
(SQLITE_OK !=
sq_prepare (plugin->dbh,
- "SELECT record_count,record_data,label"
- " FROM ns097records WHERE zone_private_key=?"
- " ORDER BY rvalue LIMIT ? OFFSET ?",
+ "SELECT uid,record_count,record_data,label"
+ " FROM ns098records"
+ " WHERE zone_private_key=? AND _rowid_ >= ?"
+ " ORDER BY _rowid_ ASC"
+ " LIMIT ?",
&plugin->iterate_zone)) ||
(SQLITE_OK !=
sq_prepare (plugin->dbh,
- "SELECT record_count,record_data,label,zone_private_key"
- " FROM ns097records ORDER BY rvalue LIMIT ? OFFSET ?",
+ "SELECT uid,record_count,record_data,label,zone_private_key"
+ " FROM ns098records"
+ " WHERE _rowid_ >= ?"
+ " ORDER BY _rowid_ ASC"
+ " LIMIT ?",
&plugin->iterate_all_zones)) ||
(SQLITE_OK !=
sq_prepare (plugin->dbh,
- "SELECT record_count,record_data,label,zone_private_key"
- " FROM ns097records WHERE zone_private_key=? AND label=?",
+ "SELECT uid,record_count,record_data,label,zone_private_key"
+ " FROM ns098records"
+ " WHERE zone_private_key=? AND label=?",
&plugin->lookup_label))
)
{
struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
uint64_t rvalue;
size_t data_size;
- unsigned int i;
- memset (&pkey, 0, sizeof (pkey));
- for (i=0;i<rd_count;i++)
+ memset (&pkey,
+ 0,
+ sizeof (pkey));
+ for (unsigned int i=0;i<rd_count;i++)
if (GNUNET_GNSRECORD_TYPE_PKEY == rd[i].record_type)
{
GNUNET_break (sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) ==
GNUNET_NAMESTORE_RecordIterator iter,
void *iter_cls)
{
- uint32_t record_count;
- size_t data_size;
- void *data;
- char *label;
- struct GNUNET_CRYPTO_EcdsaPrivateKey zk;
int ret;
int sret;
ret = GNUNET_OK;
for (uint64_t i = 0;i<limit ; i++)
{
- if (SQLITE_ROW == (sret = sqlite3_step (stmt)))
+ sret = sqlite3_step (stmt);
+
+ if (SQLITE_DONE == sret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Iteration done (no results)\n");
+ ret = GNUNET_NO;
+ break;
+ }
+ if (SQLITE_ROW != sret)
{
+ LOG_SQLITE (plugin,
+ GNUNET_ERROR_TYPE_ERROR,
+ "sqlite_step");
+ ret = GNUNET_SYSERR;
+ break;
+ }
+
+ {
+ uint64_t seq;
+ uint32_t record_count;
+ size_t data_size;
+ void *data;
+ char *label;
+ struct GNUNET_CRYPTO_EcdsaPrivateKey zk;
struct GNUNET_SQ_ResultSpec rs[] = {
+ GNUNET_SQ_result_spec_uint64 (&seq),
GNUNET_SQ_result_spec_uint32 (&record_count),
- GNUNET_SQ_result_spec_variable_size (&data, &data_size),
+ GNUNET_SQ_result_spec_variable_size (&data,
+ &data_size),
GNUNET_SQ_result_spec_string (&label),
GNUNET_SQ_result_spec_end
};
struct GNUNET_SQ_ResultSpec rsx[] = {
+ GNUNET_SQ_result_spec_uint64 (&seq),
GNUNET_SQ_result_spec_uint32 (&record_count),
- GNUNET_SQ_result_spec_variable_size (&data, &data_size),
+ GNUNET_SQ_result_spec_variable_size (&data,
+ &data_size),
GNUNET_SQ_result_spec_string (&label),
GNUNET_SQ_result_spec_auto_from_type (&zk),
GNUNET_SQ_result_spec_end
{
if (NULL != iter)
iter (iter_cls,
+ seq + 1,
zone_key,
label,
record_count,
}
GNUNET_SQ_cleanup_result (rs);
}
- else
- {
- if (SQLITE_DONE != sret)
- {
- LOG_SQLITE (plugin,
- GNUNET_ERROR_TYPE_ERROR,
- "sqlite_step");
- ret = GNUNET_SYSERR;
- }
- else
- {
- ret = GNUNET_NO;
- }
- break;
- }
}
GNUNET_SQ_reset (plugin->dbh,
stmt);
*
* @param cls closure (internal context for the plugin)
* @param zone hash of public key of the zone, NULL to iterate over all zones
- * @param offset offset in the list of all matching records
+ * @param serial serial number to exclude in the list of all matching records
* @param limit maximum number of results to return
* @param iter function to call with the result
* @param iter_cls closure for @a iter
static int
namestore_sqlite_iterate_records (void *cls,
const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
- uint64_t offset,
+ uint64_t serial,
uint64_t limit,
GNUNET_NAMESTORE_RecordIterator iter,
void *iter_cls)
if (NULL == zone)
{
struct GNUNET_SQ_QueryParam params[] = {
+ GNUNET_SQ_query_param_uint64 (&serial),
GNUNET_SQ_query_param_uint64 (&limit),
- GNUNET_SQ_query_param_uint64 (&offset),
GNUNET_SQ_query_param_end
};
{
struct GNUNET_SQ_QueryParam params[] = {
GNUNET_SQ_query_param_auto_from_type (zone),
+ GNUNET_SQ_query_param_uint64 (&serial),
GNUNET_SQ_query_param_uint64 (&limit),
- GNUNET_SQ_query_param_uint64 (&offset),
GNUNET_SQ_query_param_end
};
namestore_sqlite_zone_to_name (void *cls,
const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
const struct GNUNET_CRYPTO_EcdsaPublicKey *value_zone,
- GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
+ GNUNET_NAMESTORE_RecordIterator iter,
+ void *iter_cls)
{
struct Plugin *plugin = cls;
struct GNUNET_SQ_QueryParam params[] = {
static void
-put_cont (void *cls, int32_t success, const char *emsg)
+put_cont (void *cls,
+ int32_t success,
+ const char *emsg)
{
static int c = 0;
char *label = cls;
else
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Failed to created records\n");
+ "Failed to create record `%s'\n",
+ label);
GNUNET_break (0);
GNUNET_SCHEDULER_cancel (endbadly_task);
- endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL);
+ endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly,
+ NULL);
}
}
/* name in different zone */
GNUNET_asprintf(&s_name_3, "dummy3");
s_rd_3 = create_record(1);
- GNUNET_assert (NULL != (ns_ops[2] = GNUNET_NAMESTORE_records_store (nsh, privkey2, s_name_3,
- 1, s_rd_3, &put_cont, s_name_3)));
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 1\n");
+ GNUNET_assert (NULL != (ns_ops[2] =
+ GNUNET_NAMESTORE_records_store (nsh,
+ privkey2,
+ s_name_3,
+ 1,
+ s_rd_3,
+ &put_cont,
+ s_name_3)));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Created record 1\n");
GNUNET_asprintf(&s_name_1, "dummy1");
s_rd_1 = create_record(1);
GNUNET_assert (NULL != (ns_ops[0] = GNUNET_NAMESTORE_records_store(nsh, privkey, s_name_1,
static void
test_record (void *cls,
+ uint64_t seq,
const struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key,
const char *label,
unsigned int rd_count,
GNUNET_assert (rd[i].record_type == 1 + (id % 13));
GNUNET_assert (rd[i].flags == 0);
}
- memset (&tzone_private_key, (id % 241), sizeof (tzone_private_key));
+ memset (&tzone_private_key,
+ (id % 241),
+ sizeof (tzone_private_key));
GNUNET_assert (0 == strcmp (label, tname));
GNUNET_assert (0 == memcmp (&tzone_private_key,
private_key,
}
memset (&zone_private_key, (id % 241), sizeof (zone_private_key));
memset (&signature, (id % 243), sizeof (signature));
- GNUNET_assert (GNUNET_OK == nsp->store_records (nsp->cls,
- &zone_private_key,
- label,
- rd_count,
- rd));
+ GNUNET_assert (GNUNET_OK ==
+ nsp->store_records (nsp->cls,
+ &zone_private_key,
+ label,
+ rd_count,
+ rd));
}