uint32_t anonymity GNUNET_PACKED;
/**
- * Desired replication level. 0 from service to API.
+ * Desired replication level.
*/
uint32_t replication GNUNET_PACKED;
qc.rc.proc (qc.rc.proc_cls,
NULL,
0,
- NULL, 0, 0, 0,
+ NULL,
+ 0,
+ 0,
+ 0,
+ 0,
GNUNET_TIME_UNIT_ZERO_ABS,
0);
break;
qe->qc.rc.proc (qe->qc.rc.proc_cls,
NULL,
0,
- NULL, 0, 0, 0,
+ NULL,
+ 0,
+ 0,
+ 0,
+ 0,
GNUNET_TIME_UNIT_ZERO_ABS,
0);
break;
ntohl (dm->type),
ntohl (dm->priority),
ntohl (dm->anonymity),
+ ntohl (dm->replication),
GNUNET_TIME_absolute_ntoh (dm->expiration),
GNUNET_ntohll (dm->uid));
}
0,
0,
0,
+ 0,
GNUNET_TIME_UNIT_ZERO_ABS,
0);
}
dm->priority = htonl (priority);
dm->anonymity = htonl (anonymity);
dm->replication = htonl (replication);
- dm->reserved = htonl (0);
- dm->uid = GNUNET_htonll (0);
dm->expiration = GNUNET_TIME_absolute_hton (expiration);
dm->key = *key;
GNUNET_memcpy (&dm[1],
env = GNUNET_MQ_msg_extra (dm,
size,
GNUNET_MESSAGE_TYPE_DATASTORE_REMOVE);
- dm->rid = htonl (0);
dm->size = htonl (size);
- dm->type = htonl (0);
- dm->priority = htonl (0);
- dm->anonymity = htonl (0);
- dm->uid = GNUNET_htonll (0);
- dm->expiration = GNUNET_TIME_absolute_hton (GNUNET_TIME_UNIT_ZERO_ABS);
dm->key = *key;
GNUNET_memcpy (&dm[1],
data,
* @param type type of the content
* @param priority priority of the content
* @param anonymity anonymity-level for the content
+ * @param replication replication-level for the content
* @param expiration expiration time for the content
* @param uid unique identifier for the datum;
* maybe 0 if no unique identifier is available
*/
static void
do_put (void *cls,
- const struct GNUNET_HashCode *key,
- size_t size,
+ const struct GNUNET_HashCode *key,
+ size_t size,
const void *data,
- enum GNUNET_BLOCK_Type type,
- uint32_t priority,
- uint32_t anonymity,
- struct GNUNET_TIME_Absolute
- expiration, uint64_t uid)
+ enum GNUNET_BLOCK_Type type,
+ uint32_t priority,
+ uint32_t anonymity,
+ uint32_t replication,
+ struct GNUNET_TIME_Absolute
+ expiration,
+ uint64_t uid)
{
qe = NULL;
if ( (0 != offset) &&
}
if (0 == offset)
first_uid = uid;
- qe = GNUNET_DATASTORE_put (db_dst, 0,
- key, size, data, type,
- priority, anonymity,
- 0 /* FIXME: replication is lost... */,
- expiration,
- 0, 1,
- &do_finish, NULL);
+ qe = GNUNET_DATASTORE_put (db_dst,
+ 0,
+ key,
+ size,
+ data,
+ type,
+ priority,
+ anonymity,
+ replication,
+ expiration,
+ 0,
+ 1,
+ &do_finish,
+ NULL);
}
* @param type type of the content
* @param priority priority of the content
* @param anonymity anonymity-level for the content
+ * @param replication replication-level for the content
* @param expiration expiration time for the content
* @param uid unique identifier for the datum;
* maybe 0 if no unique identifier is available
enum GNUNET_BLOCK_Type type,
uint32_t priority,
uint32_t anonymity,
+ uint32_t replication,
struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
{
* @param type type of the content
* @param priority priority of the content
* @param anonymity anonymity-level for the content
+ * @param replication replication-level for the content
* @param expiration expiration time for the content
* @param uid unique identifier for the datum;
* maybe 0 if no unique identifier is available
enum GNUNET_BLOCK_Type type,
uint32_t priority,
uint32_t anonymity,
+ uint32_t replication,
struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
{
* @param type type of the content
* @param priority priority of the content
* @param anonymity anonymity-level for the content
+ * @param replication replication-level for the content
* @param expiration expiration time for the content
* @param uid unique identifier for the datum;
* maybe 0 if no unique identifier is available
enum GNUNET_BLOCK_Type type,
uint32_t priority,
uint32_t anonymity,
+ uint32_t replication,
struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
{
dm->type = htonl (type);
dm->priority = htonl (priority);
dm->anonymity = htonl (anonymity);
- dm->replication = htonl (0);
- dm->reserved = htonl (0);
+ dm->replication = htonl (replication);
dm->expiration = GNUNET_TIME_absolute_hton (expiration);
dm->uid = GNUNET_htonll (uid);
dm->key = *key;
* @param type type of the content
* @param priority priority of the content
* @param anonymity anonymity-level for the content
+ * @param replication replication-level for the content
* @param expiration expiration time for the content
* @param uid unique identifier for the datum;
* maybe 0 if no unique identifier is available
*/
static int
check_present (void *cls,
- const struct GNUNET_HashCode *key,
- uint32_t size,
+ const struct GNUNET_HashCode *key,
+ uint32_t size,
const void *data,
- enum GNUNET_BLOCK_Type type,
- uint32_t priority,
+ enum GNUNET_BLOCK_Type type,
+ uint32_t priority,
uint32_t anonymity,
- struct GNUNET_TIME_Absolute expiration,
+ uint32_t replication,
+ struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
{
struct PutContext *pc = cls;
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Result already present in datastore\n");
- /* FIXME: change API to allow increasing 'replication' counter */
- if ((ntohl (dm->priority) > 0) ||
- (GNUNET_TIME_absolute_ntoh (dm->expiration).abs_value_us >
- expiration.abs_value_us))
+ if ( (ntohl (dm->priority) > 0) ||
+ (ntohl (dm->replication) > 0) ||
+ (GNUNET_TIME_absolute_ntoh (dm->expiration).abs_value_us >
+ expiration.abs_value_us) )
plugin->api->update (plugin->api->cls,
- uid,
+ uid,
ntohl (dm->priority),
+ ntohl (dm->replication),
GNUNET_TIME_absolute_ntoh (dm->expiration),
&check_present_continuation,
- pc->client);
+ pc->client);
else
{
transmit_status (pc->client,
1,
GNUNET_NO);
transmit_item (client,
- NULL, 0, NULL, 0, 0, 0,
+ NULL, 0, NULL, 0, 0, 0, 0,
GNUNET_TIME_UNIT_ZERO_ABS,
0);
GNUNET_SERVICE_client_continue (client);
* @param type type of the content
* @param priority priority of the content
* @param anonymity anonymity-level for the content
+ * @param replication replication-level for the content
* @param expiration expiration time for the content
* @param uid unique identifier for the datum
* @return #GNUNET_OK to keep the item
enum GNUNET_BLOCK_Type type,
uint32_t priority,
uint32_t anonymity,
+ uint32_t replication,
struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
{
}
if (NULL == gc.value)
{
- proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
return;
}
if (GNUNET_NO ==
gc.value->type,
gc.value->priority,
gc.value->anonymity,
+ gc.value->replication,
gc.value->expiration,
(uint64_t) (intptr_t) gc.value))
{
value = GNUNET_CONTAINER_heap_remove_root (plugin->by_replication);
if (NULL == value)
{
- proc (proc_cls,
- NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
return;
}
if (value->replication > 0)
}
if (GNUNET_NO ==
proc (proc_cls,
- &value->key,
- value->size,
- &value[1],
- value->type,
- value->priority,
- value->anonymity,
- value->expiration,
- (uint64_t) (intptr_t) value))
+ &value->key,
+ value->size,
+ &value[1],
+ value->type,
+ value->priority,
+ value->anonymity,
+ value->replication,
+ value->expiration,
+ (uint64_t) (intptr_t) value))
delete_value (plugin, value);
}
value = GNUNET_CONTAINER_heap_peek (plugin->by_expiration);
if (NULL == value)
{
- proc (proc_cls,
- NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
return;
}
if (GNUNET_NO ==
proc (proc_cls,
- &value->key,
- value->size,
- &value[1],
- value->type,
- value->priority,
- value->anonymity,
- value->expiration,
- (uint64_t) (intptr_t) value))
+ &value->key,
+ value->size,
+ &value[1],
+ value->type,
+ value->priority,
+ value->anonymity,
+ value->replication,
+ value->expiration,
+ (uint64_t) (intptr_t) value))
delete_value (plugin, value);
}
/**
- * Update the priority for a particular key in the datastore. If
- * the expiration time in value is different than the time found in
- * the datastore, the higher value should be kept. For the
- * anonymity level, the lower value is to be used. The specified
- * priority should be added to the existing priority, ignoring the
- * priority in value.
+ * Update the priority, replication and expiration for a particular
+ * unique ID in the datastore. If the expiration time in value is
+ * different than the time found in the datastore, the higher value
+ * should be kept. The specified priority and replication is added
+ * to the existing value.
*
* @param cls our `struct Plugin *`
* @param uid unique identifier of the datum
- * @param delta by how much should the priority
+ * @param priority by how much should the priority
+ * change?
+ * @param replication by how much should the replication
* change?
* @param expire new expiration time should be the
* MAX of any existing expiration time and
*/
static void
heap_plugin_update (void *cls,
- uint64_t uid,
- uint32_t delta,
- struct GNUNET_TIME_Absolute expire,
- PluginUpdateCont cont,
- void *cont_cls)
+ uint64_t uid,
+ uint32_t priority,
+ uint32_t replication,
+ struct GNUNET_TIME_Absolute expire,
+ PluginUpdateCont cont,
+ void *cont_cls)
{
struct Value *value;
GNUNET_CONTAINER_heap_update_cost (value->expire_heap,
expire.abs_value_us);
}
- /* Saturating add, don't overflow */
- if (value->priority > UINT32_MAX - delta)
+ /* Saturating adds, don't overflow */
+ if (value->priority > UINT32_MAX - priority)
value->priority = UINT32_MAX;
else
- value->priority += delta;
+ value->priority += priority;
+ if (value->replication > UINT32_MAX - replication)
+ value->replication = UINT32_MAX;
+ else
+ value->replication += replication;
cont (cont_cls, GNUNET_OK, NULL);
}
}
if (NULL == value)
{
- proc (proc_cls,
- NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
return;
}
if (GNUNET_NO ==
proc (proc_cls,
- &value->key,
- value->size,
- &value[1],
- value->type,
- value->priority,
- value->anonymity,
- value->expiration,
- (uint64_t) (intptr_t) value))
+ &value->key,
+ value->size,
+ &value[1],
+ value->type,
+ value->priority,
+ value->anonymity,
+ value->replication,
+ value->expiration,
+ (uint64_t) (intptr_t) value))
delete_value (plugin, value);
}
#define DELETE_ENTRY_BY_UID "DELETE FROM gn090 WHERE uid=?"
struct GNUNET_MYSQL_StatementHandle *delete_entry_by_uid;
-#define SELECT_ENTRY "SELECT type,prio,anonLevel,expire,hash,value,uid FROM gn090 WHERE uid >= ? AND (rvalue >= ? OR 0 = ?) ORDER BY uid LIMIT 1"
+#define RESULT_COLUMNS "repl, type, prio, anonLevel, expire, hash, value, uid"
+
+#define SELECT_ENTRY "SELECT " RESULT_COLUMNS " FROM gn090 "\
+ "WHERE uid >= ? AND "\
+ "(rvalue >= ? OR 0 = ?) "\
+ "ORDER BY uid LIMIT 1"
struct GNUNET_MYSQL_StatementHandle *select_entry;
-#define SELECT_ENTRY_BY_HASH "SELECT type,prio,anonLevel,expire,hash,value,uid FROM gn090 FORCE INDEX (idx_hash) WHERE hash=? AND uid >= ? AND (rvalue >= ? OR 0 = ?) ORDER BY uid LIMIT 1"
+#define SELECT_ENTRY_BY_HASH "SELECT " RESULT_COLUMNS " FROM gn090 "\
+ "FORCE INDEX (idx_hash) "\
+ "WHERE hash=? AND "\
+ "uid >= ? AND "\
+ "(rvalue >= ? OR 0 = ?) "\
+ "ORDER BY uid LIMIT 1"
struct GNUNET_MYSQL_StatementHandle *select_entry_by_hash;
-#define SELECT_ENTRY_BY_HASH_AND_VHASH "SELECT type,prio,anonLevel,expire,hash,value,uid FROM gn090 FORCE INDEX (idx_hash_vhash) WHERE hash=? AND vhash=? AND uid >= ? AND (rvalue >= ? OR 0 = ?) ORDER BY uid LIMIT 1"
+#define SELECT_ENTRY_BY_HASH_AND_VHASH "SELECT " RESULT_COLUMNS " FROM gn090 "\
+ "FORCE INDEX (idx_hash_vhash) "\
+ "WHERE hash = ? AND "\
+ "vhash = ? AND "\
+ "uid >= ? AND "\
+ "(rvalue >= ? OR 0 = ?) "\
+ "ORDER BY uid LIMIT 1"
struct GNUNET_MYSQL_StatementHandle *select_entry_by_hash_and_vhash;
-#define SELECT_ENTRY_BY_HASH_AND_TYPE "SELECT type,prio,anonLevel,expire,hash,value,uid FROM gn090 FORCE INDEX (idx_hash_type_uid) WHERE hash=? AND type=? AND uid >= ? AND (rvalue >= ? OR 0 = ?) ORDER BY uid LIMIT 1"
+#define SELECT_ENTRY_BY_HASH_AND_TYPE "SELECT " RESULT_COLUMNS " FROM gn090 "\
+ "FORCE INDEX (idx_hash_type_uid) "\
+ "WHERE hash = ? AND "\
+ "type = ? AND "\
+ "uid >= ? AND "\
+ "(rvalue >= ? OR 0 = ?) "\
+ "ORDER BY uid LIMIT 1"
struct GNUNET_MYSQL_StatementHandle *select_entry_by_hash_and_type;
-#define SELECT_ENTRY_BY_HASH_VHASH_AND_TYPE "SELECT type,prio,anonLevel,expire,hash,value,uid FROM gn090 FORCE INDEX (idx_hash_vhash) WHERE hash=? AND vhash=? AND type=? AND uid >= ? AND (rvalue >= ? OR 0 = ?) ORDER BY uid LIMIT 1"
+#define SELECT_ENTRY_BY_HASH_VHASH_AND_TYPE "SELECT " RESULT_COLUMNS " "\
+ "FROM gn090 "\
+ "FORCE INDEX (idx_hash_vhash) "\
+ "WHERE hash = ? AND "\
+ "vhash = ? AND "\
+ "type = ? AND "\
+ "uid >= ? AND "\
+ "(rvalue >= ? OR 0 = ?) "\
+ "ORDER BY uid LIMIT 1"
struct GNUNET_MYSQL_StatementHandle *select_entry_by_hash_vhash_and_type;
-#define UPDATE_ENTRY "UPDATE gn090 SET prio=prio+?,expire=IF(expire>=?,expire,?) WHERE uid=?"
+#define UPDATE_ENTRY "UPDATE gn090 SET "\
+ "prio = prio + ?, "\
+ "repl = repl + ?, "\
+ "expire = IF(expire >= ?, expire, ?) "\
+ "WHERE uid = ?"
struct GNUNET_MYSQL_StatementHandle *update_entry;
#define DEC_REPL "UPDATE gn090 SET repl=GREATEST (1, repl) - 1 WHERE uid=?"
#define SELECT_SIZE "SELECT SUM(LENGTH(value)+256) FROM gn090"
struct GNUNET_MYSQL_StatementHandle *get_size;
-#define SELECT_IT_NON_ANONYMOUS "SELECT type,prio,anonLevel,expire,hash,value,uid "\
- "FROM gn090 FORCE INDEX (idx_anonLevel_type_rvalue) "\
- "WHERE anonLevel=0 AND type=? AND uid >= ? "\
- "ORDER BY uid LIMIT 1"
+#define SELECT_IT_NON_ANONYMOUS "SELECT " RESULT_COLUMNS " FROM gn090 "\
+ "FORCE INDEX (idx_anonLevel_type_rvalue) "\
+ "WHERE anonLevel=0 AND "\
+ "type=? AND "\
+ "uid >= ? "\
+ "ORDER BY uid LIMIT 1"
struct GNUNET_MYSQL_StatementHandle *zero_iter;
-#define SELECT_IT_EXPIRATION "SELECT type,prio,anonLevel,expire,hash,value,uid FROM gn090 FORCE INDEX (idx_expire) WHERE expire < ? ORDER BY expire ASC LIMIT 1"
+#define SELECT_IT_EXPIRATION "SELECT " RESULT_COLUMNS " FROM gn090 "\
+ "FORCE INDEX (idx_expire) "\
+ "WHERE expire < ? "\
+ "ORDER BY expire ASC LIMIT 1"
struct GNUNET_MYSQL_StatementHandle *select_expiration;
-#define SELECT_IT_PRIORITY "SELECT type,prio,anonLevel,expire,hash,value,uid FROM gn090 FORCE INDEX (idx_prio) ORDER BY prio ASC LIMIT 1"
+#define SELECT_IT_PRIORITY "SELECT " RESULT_COLUMNS " FROM gn090 "\
+ "FORCE INDEX (idx_prio) "\
+ "ORDER BY prio ASC LIMIT 1"
struct GNUNET_MYSQL_StatementHandle *select_priority;
-#define SELECT_IT_REPLICATION "SELECT type,prio,anonLevel,expire,hash,value,uid "\
- "FROM gn090 FORCE INDEX (idx_repl_rvalue) "\
+#define SELECT_IT_REPLICATION "SELECT " RESULT_COLUMNS " FROM gn090 "\
+ "FORCE INDEX (idx_repl_rvalue) "\
"WHERE repl=? AND "\
" (rvalue>=? OR"\
" NOT EXISTS (SELECT 1 FROM gn090 FORCE INDEX (idx_repl_rvalue) WHERE repl=? AND rvalue>=?)) "\
/**
- * Update the priority for a particular key in the datastore. If
- * the expiration time in value is different than the time found in
- * the datastore, the higher value should be kept. For the
- * anonymity level, the lower value is to be used. The specified
- * priority should be added to the existing priority, ignoring the
- * priority in value.
- *
- * Note that it is possible for multiple values to match this put.
- * In that case, all of the respective values are updated.
+ * Update the priority, replication and expiration for a particular
+ * unique ID in the datastore. If the expiration time in value is
+ * different than the time found in the datastore, the higher value
+ * should be kept. The specified priority and replication is added
+ * to the existing value.
*
* @param cls our "struct Plugin*"
* @param uid unique identifier of the datum
- * @param delta by how much should the priority
+ * @param priority by how much should the priority
+ * change?
+ * @param replication by how much should the replication
* change?
* @param expire new expiration time should be the
* MAX of any existing expiration time and
static void
mysql_plugin_update (void *cls,
uint64_t uid,
- uint32_t delta,
+ uint32_t priority,
+ uint32_t replication,
struct GNUNET_TIME_Absolute expire,
PluginUpdateCont cont,
void *cont_cls)
int ret;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Updating value %llu adding %d to priority and maxing exp at %s\n",
+ "Updating value %llu adding %d to priority %d to replication and maxing exp at %s\n",
(unsigned long long) uid,
- delta,
- GNUNET_STRINGS_absolute_time_to_string (expire));
+ priority,
+ replication,
+ GNUNET_STRINGS_absolute_time_to_string (expire));
struct GNUNET_MY_QueryParam params_update[] = {
- GNUNET_MY_query_param_uint32 (&delta),
+ GNUNET_MY_query_param_uint32 (&priority),
+ GNUNET_MY_query_param_uint32 (&replication),
GNUNET_MY_query_param_uint64 (&lexpire),
GNUNET_MY_query_param_uint64 (&lexpire),
GNUNET_MY_query_param_uint64 (&uid),
struct GNUNET_MY_QueryParam *params_select)
{
int ret;
+ uint32_t replication;
uint32_t type;
uint32_t priority;
uint32_t anonymity;
struct GNUNET_HashCode key;
struct GNUNET_TIME_Absolute expiration;
struct GNUNET_MY_ResultSpec results_select[] = {
+ GNUNET_MY_result_spec_uint32 (&replication),
GNUNET_MY_result_spec_uint32 (&type),
GNUNET_MY_result_spec_uint32 (&priority),
GNUNET_MY_result_spec_uint32 (&anonymity),
if (GNUNET_OK != ret)
{
proc (proc_cls,
- NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
return;
}
if (GNUNET_OK != ret)
{
proc (proc_cls,
- NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
return;
}
type,
priority,
anonymity,
+ replication,
expiration,
uid);
GNUNET_MY_cleanup_result (results_select);
* @param type type of the content
* @param priority priority of the content
* @param anonymity anonymity-level for the content
+ * @param replication replication-level for the content
* @param expiration expiration time for the content
* @param uid unique identifier for the datum;
* maybe 0 if no unique identifier is available
enum GNUNET_BLOCK_Type type,
uint32_t priority,
uint32_t anonymity,
+ uint32_t replication,
struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
{
type,
priority,
anonymity,
+ replication,
expiration,
uid);
if (NULL != key)
plugin->max_repl,
params_get))
{
- proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
return;
}
GNUNET_MY_extract_result (plugin->max_repl,
results_get))
{
- proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
return;
}
GNUNET_break (GNUNET_NO ==
* @param type type of the content
* @param priority priority of the content
* @param anonymity anonymity-level for the content
+ * @param replication replication-level for the content
* @param expiration expiration time for the content
* @param uid unique identifier for the datum;
* maybe 0 if no unique identifier is available
enum GNUNET_BLOCK_Type type,
uint32_t priority,
uint32_t anonymity,
+ uint32_t replication,
struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
{
type,
priority,
anonymity,
+ replication,
expiration,
uid);
}
return GNUNET_SYSERR;
}
PQclear (ret);
+#define RESULT_COLUMNS "repl, type, prio, anonLevel, expire, hash, value, oid"
if ((GNUNET_OK !=
GNUNET_POSTGRES_prepare (plugin->dbh, "get",
- "SELECT type, prio, anonLevel, expire, hash, value, oid FROM gn090 "
+ "SELECT " RESULT_COLUMNS " FROM gn090 "
"WHERE oid >= $1::bigint AND "
"(rvalue >= $2 OR 0 = $3::smallint) AND "
"(hash = $4 OR 0 = $5::smallint) AND "
"VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)", 9)) ||
(GNUNET_OK !=
GNUNET_POSTGRES_prepare (plugin->dbh, "update",
- "UPDATE gn090 SET prio = prio + $1, expire = CASE WHEN expire < $2 THEN $2 ELSE expire END "
- "WHERE oid = $3", 3)) ||
+ "UPDATE gn090 "
+ "SET prio = prio + $1, "
+ "repl = repl + $2, "
+ "expire = CASE WHEN expire < $3 THEN $3 ELSE expire END "
+ "WHERE oid = $4", 4)) ||
(GNUNET_OK !=
GNUNET_POSTGRES_prepare (plugin->dbh, "decrepl",
"UPDATE gn090 SET repl = GREATEST (repl - 1, 0) "
"WHERE oid = $1", 1)) ||
(GNUNET_OK !=
GNUNET_POSTGRES_prepare (plugin->dbh, "select_non_anonymous",
- "SELECT type, prio, anonLevel, expire, hash, value, oid FROM gn090 "
+ "SELECT " RESULT_COLUMNS " FROM gn090 "
"WHERE anonLevel = 0 AND type = $1 AND oid >= $2::bigint "
"ORDER BY oid ASC LIMIT 1",
2)) ||
(GNUNET_OK !=
GNUNET_POSTGRES_prepare (plugin->dbh, "select_expiration_order",
- "(SELECT type, prio, anonLevel, expire, hash, value, oid FROM gn090 "
- "WHERE expire < $1 ORDER BY prio ASC LIMIT 1) " "UNION "
- "(SELECT type, prio, anonLevel, expire, hash, value, oid FROM gn090 "
- "ORDER BY prio ASC LIMIT 1) " "ORDER BY expire ASC LIMIT 1",
+ "(SELECT " RESULT_COLUMNS " FROM gn090 "
+ "WHERE expire < $1 ORDER BY prio ASC LIMIT 1) "
+ "UNION "
+ "(SELECT " RESULT_COLUMNS " FROM gn090 "
+ "ORDER BY prio ASC LIMIT 1) "
+ "ORDER BY expire ASC LIMIT 1",
1)) ||
(GNUNET_OK !=
GNUNET_POSTGRES_prepare (plugin->dbh, "select_replication_order",
- "SELECT type, prio, anonLevel, expire, hash, value, oid FROM gn090 "
+ "SELECT " RESULT_COLUMNS " FROM gn090 "
"ORDER BY repl DESC,RANDOM() LIMIT 1", 0)) ||
(GNUNET_OK !=
GNUNET_POSTGRES_prepare (plugin->dbh, "delrow", "DELETE FROM gn090 " "WHERE oid=$1", 1)) ||
uint32_t rowid;
uint32_t utype;
uint32_t anonymity;
+ uint32_t replication;
uint32_t priority;
size_t size;
void *data;
struct GNUNET_TIME_Absolute expiration_time;
struct GNUNET_HashCode key;
struct GNUNET_PQ_ResultSpec rs[] = {
+ GNUNET_PQ_result_spec_uint32 ("repl", &replication),
GNUNET_PQ_result_spec_uint32 ("type", &utype),
GNUNET_PQ_result_spec_uint32 ("prio", &priority),
GNUNET_PQ_result_spec_uint32 ("anonLevel", &anonymity),
- GNUNET_PQ_result_spec_uint32 ("oid", &rowid),
GNUNET_PQ_result_spec_absolute_time ("expire", &expiration_time),
GNUNET_PQ_result_spec_auto_from_type ("hash", &key),
GNUNET_PQ_result_spec_variable_size ("value", &data, &size),
+ GNUNET_PQ_result_spec_uint32 ("oid", &rowid),
GNUNET_PQ_result_spec_end
};
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
"datastore-postgres",
"Ending iteration (postgres error)\n");
- proc (proc_cls, NULL, 0, NULL, 0, 0, 0,
- GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
return;
}
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
"datastore-postgres",
"Ending iteration (no more results)\n");
- proc (proc_cls, NULL, 0, NULL, 0, 0, 0,
- GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
PQclear (res);
return;
}
if (1 != PQntuples (res))
{
GNUNET_break (0);
- proc (proc_cls, NULL, 0, NULL, 0, 0, 0,
- GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
PQclear (res);
return;
}
GNUNET_POSTGRES_delete_by_rowid (plugin->dbh,
"delrow",
rowid);
- proc (proc_cls, NULL, 0, NULL, 0, 0, 0,
- GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
return;
}
(unsigned int) size,
(unsigned int) utype);
iret = proc (proc_cls,
- &key,
- size,
- data,
- (enum GNUNET_BLOCK_Type) utype,
- priority,
- anonymity,
- expiration_time,
- rowid);
+ &key,
+ size,
+ data,
+ (enum GNUNET_BLOCK_Type) utype,
+ priority,
+ anonymity,
+ replication,
+ expiration_time,
+ rowid);
PQclear (res);
if (iret == GNUNET_NO)
{
* @param type type of the content
* @param priority priority of the content
* @param anonymity anonymity-level for the content
+ * @param replication replication-level for the content
* @param expiration expiration time for the content
* @param uid unique identifier for the datum;
* maybe 0 if no unique identifier is available
*/
static int
repl_proc (void *cls,
- const struct GNUNET_HashCode *key,
- uint32_t size,
+ const struct GNUNET_HashCode *key,
+ uint32_t size,
const void *data,
- enum GNUNET_BLOCK_Type type,
- uint32_t priority,
+ enum GNUNET_BLOCK_Type type,
+ uint32_t priority,
uint32_t anonymity,
- struct GNUNET_TIME_Absolute expiration,
+ uint32_t replication,
+ struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
{
struct ReplCtx *rc = cls;
PGresult *qret;
ret = rc->proc (rc->proc_cls,
- key,
- size, data,
- type,
- priority,
- anonymity,
- expiration, uid);
+ key,
+ size,
+ data,
+ type,
+ priority,
+ anonymity,
+ replication,
+ expiration,
+ uid);
if (NULL == key)
return ret;
qret = GNUNET_PQ_exec_prepared (plugin->dbh,
/**
- * Update the priority for a particular key in the datastore. If
- * the expiration time in value is different than the time found in
- * the datastore, the higher value should be kept. For the
- * anonymity level, the lower value is to be used. The specified
- * priority should be added to the existing priority, ignoring the
- * priority in value.
- *
- * Note that it is possible for multiple values to match this put.
- * In that case, all of the respective values are updated.
+ * Update the priority, replication and expiration for a particular
+ * unique ID in the datastore. If the expiration time in value is
+ * different than the time found in the datastore, the higher value
+ * should be kept. The specified priority and replication is added
+ * to the existing value.
*
* @param cls our `struct Plugin *`
* @param uid unique identifier of the datum
- * @param delta by how much should the priority
+ * @param priority by how much should the priority
+ * change?
+ * @param replication by how much should the replication
* change?
* @param expire new expiration time should be the
* MAX of any existing expiration time and
*/
static void
postgres_plugin_update (void *cls,
- uint64_t uid,
- uint32_t delta,
+ uint64_t uid,
+ uint32_t priority,
+ uint32_t replication,
struct GNUNET_TIME_Absolute expire,
PluginUpdateCont cont,
- void *cont_cls)
+ void *cont_cls)
{
struct Plugin *plugin = cls;
uint32_t oid = (uint32_t) uid;
struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_uint32 (&delta),
+ GNUNET_PQ_query_param_uint32 (&priority),
+ GNUNET_PQ_query_param_uint32 (&replication),
GNUNET_PQ_query_param_absolute_time (&expire),
GNUNET_PQ_query_param_uint32 (&oid),
GNUNET_PQ_query_param_end
sqlite3_finalize (stmt);
create_indices (plugin->dbh);
+#define RESULT_COLUMNS "repl, type, prio, anonLevel, expire, hash, value, _ROWID_"
if ( (SQLITE_OK !=
sq_prepare (plugin->dbh,
"UPDATE gn090 "
- "SET prio = prio + ?, expire = MAX(expire,?) WHERE _ROWID_ = ?",
+ "SET prio = prio + ?, "
+ "repl = repl + ?, "
+ "expire = MAX(expire, ?) "
+ "WHERE _ROWID_ = ?",
&plugin->updPrio)) ||
(SQLITE_OK !=
sq_prepare (plugin->dbh,
&plugin->updRepl)) ||
(SQLITE_OK !=
sq_prepare (plugin->dbh,
- "SELECT type,prio,anonLevel,expire,hash,value,_ROWID_ " "FROM gn090 "
+ "SELECT " RESULT_COLUMNS " FROM gn090 "
#if SQLITE_VERSION_NUMBER >= 3007000
"INDEXED BY idx_repl_rvalue "
#endif
&plugin->maxRepl)) ||
(SQLITE_OK !=
sq_prepare (plugin->dbh,
- "SELECT type,prio,anonLevel,expire,hash,value,_ROWID_ " "FROM gn090 "
+ "SELECT " RESULT_COLUMNS " FROM gn090 "
#if SQLITE_VERSION_NUMBER >= 3007000
"INDEXED BY idx_expire "
#endif
&plugin->selExpi)) ||
(SQLITE_OK !=
sq_prepare (plugin->dbh,
- "SELECT type,prio,anonLevel,expire,hash,value,_ROWID_ " "FROM gn090 "
+ "SELECT " RESULT_COLUMNS " FROM gn090 "
#if SQLITE_VERSION_NUMBER >= 3007000
"INDEXED BY idx_anon_type_hash "
#endif
&plugin->insertContent)) ||
(SQLITE_OK !=
sq_prepare (plugin->dbh,
- "SELECT type, prio, anonLevel, expire, hash, value, _ROWID_ FROM gn090 "
+ "SELECT " RESULT_COLUMNS " FROM gn090 "
"WHERE _ROWID_ >= ? AND "
"(rvalue >= ? OR 0 = ?) AND "
"(hash = ? OR 0 = ?) AND "
/**
- * Update the priority for a particular key in the datastore. If
- * the expiration time in value is different than the time found in
- * the datastore, the higher value should be kept. For the
- * anonymity level, the lower value is to be used. The specified
- * priority should be added to the existing priority, ignoring the
- * priority in value.
- *
- * Note that it is possible for multiple values to match this put.
- * In that case, all of the respective values are updated.
+ * Update the priority, replication and expiration for a particular
+ * unique ID in the datastore. If the expiration time in value is
+ * different than the time found in the datastore, the higher value
+ * should be kept. The specified priority and replication is added
+ * to the existing value.
*
* @param cls the plugin context (state for this module)
* @param uid unique identifier of the datum
- * @param delta by how much should the priority
+ * @param priority by how much should the priority
+ * change?
+ * @param replication by how much should the replication
* change?
* @param expire new expiration time should be the
* MAX of any existing expiration time and
static void
sqlite_plugin_update (void *cls,
uint64_t uid,
- uint32_t delta,
+ uint32_t priority,
+ uint32_t replication,
struct GNUNET_TIME_Absolute expire,
PluginUpdateCont cont,
void *cont_cls)
{
struct Plugin *plugin = cls;
struct GNUNET_SQ_QueryParam params[] = {
- GNUNET_SQ_query_param_uint32 (&delta),
+ GNUNET_SQ_query_param_uint32 (&priority),
+ GNUNET_SQ_query_param_uint32 (&replication),
GNUNET_SQ_query_param_absolute_time (&expire),
GNUNET_SQ_query_param_uint64 (&uid),
GNUNET_SQ_query_param_end
{
int n;
struct GNUNET_TIME_Absolute expiration;
+ uint32_t replication;
uint32_t type;
uint32_t priority;
uint32_t anonymity;
struct GNUNET_HashCode key;
int ret;
struct GNUNET_SQ_ResultSpec rs[] = {
+ GNUNET_SQ_result_spec_uint32 (&replication),
GNUNET_SQ_result_spec_uint32 (&type),
GNUNET_SQ_result_spec_uint32 (&priority),
GNUNET_SQ_result_spec_uint32 (&anonymity),
type,
priority,
anonymity,
+ replication,
expiration,
rowid);
GNUNET_SQ_cleanup_result (rs);
GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
"sqlite3_reset");
GNUNET_break (0);
- proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
database_shutdown (plugin);
database_setup (plugin->env->cfg,
plugin);
}
GNUNET_SQ_reset (plugin->dbh,
stmt);
- proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
}
GNUNET_SQ_bind (plugin->selZeroAnon,
params))
{
- proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
return;
}
execute_get (plugin, plugin->selZeroAnon, proc, proc_cls);
GNUNET_SQ_bind (plugin->get,
params))
{
- proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
return;
}
execute_get (plugin,
* @param type type of the content
* @param priority priority of the content
* @param anonymity anonymity-level for the content
+ * @param replication replication-level for the content
* @param expiration expiration time for the content
* @param uid unique identifier for the datum;
* maybe 0 if no unique identifier is available
enum GNUNET_BLOCK_Type type,
uint32_t priority,
uint32_t anonymity,
+ uint32_t replication,
struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
{
type,
priority,
anonymity,
+ replication,
expiration,
uid);
if (NULL != key)
GNUNET_SQ_reset (plugin->dbh,
plugin->maxRepl);
/* DB empty */
- proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
return;
}
repl = sqlite3_column_int (plugin->maxRepl,
GNUNET_SQ_bind (plugin->selRepl,
params_sel_repl))
{
- proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
return;
}
rc.have_uid = GNUNET_SYSERR;
GNUNET_SQ_bind (plugin->updRepl,
params_upd_repl))
{
- proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
return;
}
if (SQLITE_DONE !=
if (GNUNET_SYSERR == rc.have_uid)
{
/* proc was not called at all so far, do it now. */
- proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
}
}
GNUNET_SQ_bind (stmt,
params))
{
- proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
return;
}
execute_get (plugin, stmt, proc, proc_cls);
/**
- * Update the priority for a particular key in the datastore. If
- * the expiration time in value is different than the time found in
- * the datastore, the higher value should be kept. For the
- * anonymity level, the lower value is to be used. The specified
- * priority should be added to the existing priority, ignoring the
- * priority in value.
- *
- * Note that it is possible for multiple values to match this put.
- * In that case, all of the respective values are updated.
+ * Update the priority, replication and expiration for a particular
+ * unique ID in the datastore. If the expiration time in value is
+ * different than the time found in the datastore, the higher value
+ * should be kept. The specified priority and replication is added
+ * to the existing value.
*
* @param cls our "struct Plugin*"
* @param uid unique identifier of the datum
- * @param delta by how much should the priority
+ * @param priority by how much should the priority
+ * change?
+ * @param replication by how much should the replication
* change?
* @param expire new expiration time should be the
* MAX of any existing expiration time and
* @param cons_cls continuation closure
*/
static void
-template_plugin_update (void *cls, uint64_t uid, uint32_t delta,
+template_plugin_update (void *cls,
+ uint64_t uid,
+ uint32_t priority,
+ uint32_t replication,
struct GNUNET_TIME_Absolute expire,
- PluginUpdateCont cont, void *cont_cls)
+ PluginUpdateCont cont,
+ void *cont_cls)
{
GNUNET_break (0);
cont (cont_cls, GNUNET_SYSERR, "not implemented");
enum GNUNET_BLOCK_Type type,
uint32_t priority,
uint32_t anonymity,
+ uint32_t replication,
struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
{
enum GNUNET_BLOCK_Type type,
uint32_t priority,
uint32_t anonymity,
+ uint32_t replication,
struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
{
enum GNUNET_BLOCK_Type type,
uint32_t priority,
uint32_t anonymity,
+ uint32_t replication,
struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
{
enum GNUNET_BLOCK_Type type,
uint32_t priority,
uint32_t anonymity,
+ uint32_t replication,
struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
{
static void
-check_value (void *cls, const struct GNUNET_HashCode * key, size_t size,
- const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
- uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
+check_value (void *cls,
+ const struct GNUNET_HashCode *key,
+ size_t size,
+ const void *data,
+ enum GNUNET_BLOCK_Type type,
+ uint32_t priority,
+ uint32_t anonymity,
+ uint32_t replication,
+ struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
{
struct CpsRunContext *crc = cls;
static void
-check_nothing (void *cls, const struct GNUNET_HashCode * key, size_t size,
- const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
- uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
+check_nothing (void *cls,
+ const struct GNUNET_HashCode *key,
+ size_t size,
+ const void *data,
+ enum GNUNET_BLOCK_Type type,
+ uint32_t priority,
+ uint32_t anonymity,
+ uint32_t replication,
+ struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
{
struct CpsRunContext *crc = cls;
enum GNUNET_BLOCK_Type type,
uint32_t priority,
uint32_t anonymity,
+ uint32_t replication,
struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
{
break;
case RP_UPDATE:
crc->api->update (crc->api->cls,
- guid,
- 1,
- GNUNET_TIME_UNIT_ZERO_ABS,
+ guid,
+ 1,
+ 1,
+ GNUNET_TIME_UNIT_ZERO_ABS,
&update_continuation,
- crc);
+ crc);
break;
case RP_ITER_ZERO:
* @param type type of the content
* @param priority priority of the content
* @param anonymity anonymity-level for the content
+ * @param replication replication-level for the content
* @param expiration expiration time for the content
* @param uid unique identifier for the datum;
* maybe 0 if no unique identifier is available
*/
static void
handle_datastore_reply (void *cls,
- const struct GNUNET_HashCode *key,
- size_t size,
- const void *data,
- enum GNUNET_BLOCK_Type type,
- uint32_t priority,
- uint32_t anonymity,
- struct GNUNET_TIME_Absolute expiration,
+ const struct GNUNET_HashCode *key,
+ size_t size,
+ const void *data,
+ enum GNUNET_BLOCK_Type type,
+ uint32_t priority,
+ uint32_t anonymity,
+ uint32_t replication,
+ struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
{
struct CadetClient *sc = cls;
GNUNET_h2s (key));
if (GNUNET_OK !=
GNUNET_FS_handle_on_demand_block (key,
- size,
- data,
- type,
- priority,
- anonymity,
- expiration,
- uid,
- &handle_datastore_reply,
- sc))
+ size,
+ data,
+ type,
+ priority,
+ anonymity,
+ replication,
+ expiration,
+ uid,
+ &handle_datastore_reply,
+ sc))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"On-demand encoding request failed\n");
* @param type type of the content
* @param priority priority of the content
* @param anonymity anonymity-level for the content
+ * @param replication replication-level for the content
* @param expiration expiration time for the content
* @param uid unique identifier for the datum;
* maybe 0 if no unique identifier is available
enum GNUNET_BLOCK_Type type,
uint32_t priority,
uint32_t anonymity,
+ uint32_t replication,
struct GNUNET_TIME_Absolute expiration,
uint64_t uid,
GNUNET_DATASTORE_DatumProcessor cont,
GNUNET_BLOCK_TYPE_FS_DBLOCK,
priority,
anonymity,
+ replication,
expiration,
uid);
return GNUNET_OK;
* @param type type of the content
* @param priority priority of the content
* @param anonymity anonymity-level for the content
+ * @param replication replication-level for the content
* @param expiration expiration time for the content
* @param uid unique identifier for the datum;
* maybe 0 if no unique identifier is available
* @return #GNUNET_OK on success
*/
int
-GNUNET_FS_handle_on_demand_block (const struct GNUNET_HashCode * key, uint32_t size,
- const void *data, enum GNUNET_BLOCK_Type type,
- uint32_t priority, uint32_t anonymity,
+GNUNET_FS_handle_on_demand_block (const struct GNUNET_HashCode *key,
+ uint32_t size,
+ const void *data,
+ enum GNUNET_BLOCK_Type type,
+ uint32_t priority,
+ uint32_t anonymity,
+ uint32_t replication,
struct GNUNET_TIME_Absolute expiration,
uint64_t uid,
GNUNET_DATASTORE_DatumProcessor cont,
enum GNUNET_BLOCK_Type type,
uint32_t priority,
uint32_t anonymity,
+ uint32_t replication,
struct GNUNET_TIME_Absolute expiration,
uint64_t uid);
* @param type type of the content
* @param priority priority of the content
* @param anonymity anonymity-level for the content
+ * @param replication replication-level for the content
* @param expiration expiration time for the content
* @param uid unique identifier for the datum;
* maybe 0 if no unique identifier is available
enum GNUNET_BLOCK_Type type,
uint32_t priority,
uint32_t anonymity,
+ uint32_t replication,
struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
{
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
&odc_warn_delay_task, pr);
if (GNUNET_OK ==
- GNUNET_FS_handle_on_demand_block (key, size, data, type, priority,
- anonymity, expiration, uid,
- &process_local_reply, pr))
+ GNUNET_FS_handle_on_demand_block (key,
+ size,
+ data,
+ type,
+ priority,
+ anonymity,
+ replication,
+ expiration,
+ uid,
+ &process_local_reply,
+ pr))
{
GNUNET_STATISTICS_update (GSF_stats,
gettext_noop
* @param type type of the content
* @param priority priority of the content
* @param anonymity anonymity-level for the content
+ * @param replication replication-level for the content
* @param expiration expiration time for the content
* @param uid unique identifier for the datum;
* maybe 0 if no unique identifier is available
enum GNUNET_BLOCK_Type type,
uint32_t priority,
uint32_t anonymity,
+ uint32_t replication,
struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
{
type,
priority,
anonymity,
+ replication,
expiration,
uid,
- &process_migration_content, NULL))
+ &process_migration_content,
+ NULL))
consider_gathering ();
return;
}
* @param type type of the content
* @param priority priority of the content
* @param anonymity anonymity-level for the content
+ * @param replication replication-level for the content
* @param expiration expiration time for the content
* @param uid unique identifier for the datum;
* maybe 0 if no unique identifier is available
enum GNUNET_BLOCK_Type type,
uint32_t priority,
uint32_t anonymity,
+ uint32_t replication,
struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
{
* @param type type of the content
* @param priority priority of the content
* @param anonymity anonymity-level for the content
+ * @param replication replication-level for the content
* @param expiration expiration time for the content
* @param uid unique identifier for the datum
* @return #GNUNET_OK to keep the item
*/
typedef int
(*PluginDatumProcessor) (void *cls,
- const struct GNUNET_HashCode *key,
- uint32_t size,
- const void *data,
- enum GNUNET_BLOCK_Type type,
- uint32_t priority,
- uint32_t anonymity,
- struct GNUNET_TIME_Absolute expiration,
- uint64_t uid);
+ const struct GNUNET_HashCode *key,
+ uint32_t size,
+ const void *data,
+ enum GNUNET_BLOCK_Type type,
+ uint32_t priority,
+ uint32_t anonymity,
+ uint32_t replication,
+ struct GNUNET_TIME_Absolute expiration,
+ uint64_t uid);
/**
/**
- * Update the priority for a particular key in the datastore. If
- * the expiration time in value is different than the time found in
- * the datastore, the higher value should be kept. For the
- * anonymity level, the lower value is to be used. The specified
- * priority should be added to the existing priority, ignoring the
- * priority in value.
+ * Update the priority, replication and expiration for a particular
+ * unique ID in the datastore. If the expiration time in value is
+ * different than the time found in the datastore, the higher value
+ * should be kept. The specified priority and replication is added
+ * to the existing value.
*
* @param cls closure
* @param uid unique identifier of the datum
- * @param delta by how much should the priority
+ * @param priority by how much should the priority
+ * change?
+ * @param replication by how much should the replication
* change?
* @param expire new expiration time should be the
* MAX of any existing expiration time and
*/
typedef void
(*PluginUpdate) (void *cls,
- uint64_t uid,
- uint32_t delta,
- struct GNUNET_TIME_Absolute expire,
- PluginUpdateCont cont,
- void *cont_cls);
+ uint64_t uid,
+ uint32_t priority,
+ uint32_t replication,
+ struct GNUNET_TIME_Absolute expire,
+ PluginUpdateCont cont,
+ void *cont_cls);
/**
* @param type type of the content
* @param priority priority of the content
* @param anonymity anonymity-level for the content
+ * @param replication how often should the content be replicated to other peers?
* @param expiration expiration time for the content
* @param uid unique identifier for the datum;
* maybe 0 if no unique identifier is available
enum GNUNET_BLOCK_Type type,
uint32_t priority,
uint32_t anonymity,
+ uint32_t replication,
struct GNUNET_TIME_Absolute expiration,
uint64_t uid);