uint64_t amount;
uint32_t entries;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing `%s' request\n", "RESERVE");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Processing RESERVE request\n");
amount = GNUNET_ntohll (msg->amount);
entries = ntohl (msg->entries);
used = payload + reserved;
unsigned long long rem;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Processing `%s' request\n",
- "RELEASE_RESERVE");
+ "Processing RELEASE_RESERVE request\n");
next = reservations;
prev = NULL;
while (NULL != (pos = next))
}
+/**
+ *
+ * @param cls closure
+ * @param status #GNUNET_OK or #GNUNET_SYSERR
+ * @param msg error message on error
+ */
static void
check_present_continuation (void *cls,
int status,
execute_put (pc);
return GNUNET_OK;
}
- if ((GNUNET_BLOCK_TYPE_FS_DBLOCK == type) ||
- (GNUNET_BLOCK_TYPE_FS_IBLOCK == type) || ((size == ntohl (dm->size)) &&
- (0 ==
- memcmp (&dm[1], data, size))))
+ if ( (GNUNET_BLOCK_TYPE_FS_DBLOCK == type) ||
+ (GNUNET_BLOCK_TYPE_FS_IBLOCK == type) ||
+ ( (size == ntohl (dm->size)) &&
+ (0 == memcmp (&dm[1], data, size)) ) )
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Result already present in datastore\n");
* @param message the actual message
*/
static void
-handle_put (void *cls, struct GNUNET_SERVER_Client *client,
+handle_put (void *cls,
+ struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
const struct DataMessage *dm = check_data (message);
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Processing `%s' request for `%s' of type %u\n", "PUT",
- GNUNET_h2s (&dm->key), ntohl (dm->type));
+ "Processing PUT request for `%s' of type %u\n",
+ GNUNET_h2s (&dm->key),
+ ntohl (dm->type));
rid = ntohl (dm->rid);
size = ntohl (dm->size);
if (rid > 0)
* @param message the actual message
*/
static void
-handle_get (void *cls, struct GNUNET_SERVER_Client *client,
+handle_get (void *cls,
+ struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
const struct GetMessage *msg;
}
msg = (const struct GetMessage *) message;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Processing `%s' request for `%s' of type %u\n", "GET",
- GNUNET_h2s (&msg->key), ntohl (msg->type));
+ "Processing GET request for `%s' of type %u\n",
+ GNUNET_h2s (&msg->key),
+ ntohl (msg->type));
GNUNET_STATISTICS_update (stats,
gettext_noop ("# GET requests received"),
1,
GNUNET_NO);
GNUNET_SERVER_client_keep (client);
- if ((size == sizeof (struct GetMessage)) &&
- (GNUNET_YES != GNUNET_CONTAINER_bloomfilter_test (filter, &msg->key)))
+ if ( (size == sizeof (struct GetMessage)) &&
+ (GNUNET_YES != GNUNET_CONTAINER_bloomfilter_test (filter, &msg->key)) )
{
/* don't bother database... */
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Empty result set for `%s' request for `%s' (bloomfilter).\n",
- "GET", GNUNET_h2s (&msg->key));
+ "Empty result set for GET request for `%s' (bloomfilter).\n",
+ GNUNET_h2s (&msg->key));
GNUNET_STATISTICS_update (stats,
gettext_noop
("# requests filtered by bloomfilter"),
}
+/**
+ * Function called with the result of an update operation.
+ *
+ * @param cls closure
+ * @param status #GNUNET_OK or #GNUNET_SYSERR
+ * @param msg error message on error
+ */
static void
update_continuation (void *cls,
int status,
* @param message the actual message
*/
static void
-handle_update (void *cls, struct GNUNET_SERVER_Client *client,
+handle_update (void *cls,
+ struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
const struct UpdateMessage *msg;
1,
GNUNET_NO);
msg = (const struct UpdateMessage *) message;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing `%s' request for %llu\n",
- "UPDATE", (unsigned long long) GNUNET_ntohll (msg->uid));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Processing UPDATE request for %llu\n",
+ (unsigned long long) GNUNET_ntohll (msg->uid));
GNUNET_SERVER_client_keep (client);
- plugin->api->update (plugin->api->cls, GNUNET_ntohll (msg->uid),
+ plugin->api->update (plugin->api->cls,
+ GNUNET_ntohll (msg->uid),
(int32_t) ntohl (msg->priority),
GNUNET_TIME_absolute_ntoh (msg->expiration),
- update_continuation, client);
+ &update_continuation, client);
}
* @param message the actual message
*/
static void
-handle_get_replication (void *cls, struct GNUNET_SERVER_Client *client,
+handle_get_replication (void *cls,
+ struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1,
GNUNET_NO);
GNUNET_SERVER_client_keep (client);
- plugin->api->get_replication (plugin->api->cls, &transmit_item, client);
+ plugin->api->get_replication (plugin->api->cls,
+ &transmit_item, client);
}
* @param message the actual message
*/
static void
-handle_get_zero_anonymity (void *cls, struct GNUNET_SERVER_Client *client,
+handle_get_zero_anonymity (void *cls,
+ struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
const struct GetZeroAnonymityMessage *msg =
GNUNET_NO);
GNUNET_SERVER_client_keep (client);
plugin->api->get_zero_anonymity (plugin->api->cls,
- GNUNET_ntohll (msg->offset), type,
+ GNUNET_ntohll (msg->offset),
+ type,
&transmit_item, client);
}
/**
* Callback function that will cause the item that is passed
- * in to be deleted (by returning GNUNET_NO).
+ * in to be deleted (by returning #GNUNET_NO).
+ *
+ * @param cls closure
+ * @param key key for the content
+ * @param size number of bytes in data
+ * @param data content stored
+ * @param type type of the content
+ * @param priority priority of the content
+ * @param anonymity anonymity-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
+ * #GNUNET_NO to delete the item
*/
static int
-remove_callback (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)
+remove_callback (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)
{
struct GNUNET_SERVER_Client *client = cls;
- if (key == NULL)
+ if (NULL == key)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "No further matches for `%s' request.\n",
- "REMOVE");
+ "No further matches for REMOVE request.\n");
transmit_status (client,
GNUNET_NO,
_("Content not found"));
return GNUNET_OK; /* last item */
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Item %llu matches `%s' request for key `%s' and type %u.\n",
+ "Item %llu matches REMOVE request for key `%s' and type %u.\n",
(unsigned long long) uid,
- "REMOVE",
GNUNET_h2s (key),
type);
GNUNET_STATISTICS_update (stats,
* @param message the actual message
*/
static void
-handle_remove (void *cls, struct GNUNET_SERVER_Client *client,
+handle_remove (void *cls,
+ struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
const struct DataMessage *dm = check_data (message);
struct GNUNET_HashCode vhash;
- if (dm == NULL)
+ if (NULL == dm)
{
GNUNET_break (0);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Processing `%s' request for `%s' of type %u\n", "REMOVE",
- GNUNET_h2s (&dm->key), ntohl (dm->type));
- GNUNET_STATISTICS_update (stats, gettext_noop ("# REMOVE requests received"),
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# REMOVE requests received"),
1, GNUNET_NO);
GNUNET_SERVER_client_keep (client);
- GNUNET_CRYPTO_hash (&dm[1], ntohl (dm->size), &vhash);
- plugin->api->get_key (plugin->api->cls, 0, &dm->key, &vhash,
+ GNUNET_CRYPTO_hash (&dm[1],
+ ntohl (dm->size),
+ &vhash);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Processing REMOVE request for `%s' of type %u\n",
+ GNUNET_h2s (&dm->key),
+ ntohl (dm->type));
+ plugin->api->get_key (plugin->api->cls,
+ 0,
+ &dm->key,
+ &vhash,
(enum GNUNET_BLOCK_Type) ntohl (dm->type),
&remove_callback, client);
}
* @param message the actual message
*/
static void
-handle_drop (void *cls, struct GNUNET_SERVER_Client *client,
+handle_drop (void *cls,
+ struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Processing `%s' request\n",
- "DROP");
+ "Processing DROP request\n");
do_drop = GNUNET_YES;
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
ret =
PQexec (plugin->dbh,
- "CREATE TABLE gn090 ("
+ "CREATE TABLE gn090 ("
" repl INTEGER NOT NULL DEFAULT 0,"
" type INTEGER NOT NULL DEFAULT 0,"
" prio INTEGER NOT NULL DEFAULT 0,"
" rvalue BIGINT NOT NULL DEFAULT 0,"
" hash BYTEA NOT NULL DEFAULT '',"
" vhash BYTEA NOT NULL DEFAULT '',"
- " value BYTEA NOT NULL DEFAULT '')"
+ " value BYTEA NOT NULL DEFAULT '')"
"WITH OIDS");
if ( (NULL == ret) ||
((PQresultStatus (ret) != PGRES_COMMAND_OK) &&
"SELECT SUM(LENGTH(value))+256*COUNT(*) FROM gn090", 0,
NULL, NULL, NULL, NULL, 1);
if (GNUNET_OK !=
- GNUNET_POSTGRES_check_result (plugin->dbh,
- ret,
- PGRES_TUPLES_OK,
- "PQexecParams",
+ GNUNET_POSTGRES_check_result (plugin->dbh,
+ ret,
+ PGRES_TUPLES_OK,
+ "PQexecParams",
"get_size"))
{
*estimate = 0;
* @param cont_cls continuation closure
*/
static void
-postgres_plugin_put (void *cls,
+postgres_plugin_put (void *cls,
const struct GNUNET_HashCode *key,
uint32_t size,
- const void *data,
+ const void *data,
enum GNUNET_BLOCK_Type type,
- uint32_t priority,
+ uint32_t priority,
uint32_t anonymity,
uint32_t replication,
- struct GNUNET_TIME_Absolute expiration,
+ struct GNUNET_TIME_Absolute expiration,
PluginPutCont cont,
void *cont_cls)
{
"put",
params);
if (GNUNET_OK !=
- GNUNET_POSTGRES_check_result (plugin->dbh,
- ret,
- PGRES_COMMAND_OK,
+ GNUNET_POSTGRES_check_result (plugin->dbh,
+ ret,
+ PGRES_COMMAND_OK,
"PQexecPrepared", "put"))
{
- cont (cont_cls, key, size,
- GNUNET_SYSERR,
+ cont (cont_cls, key, size,
+ GNUNET_SYSERR,
_("Postgress exec failure"));
return;
}
PQclear (ret);
- plugin->env->duc (plugin->env->cls,
+ plugin->env->duc (plugin->env->cls,
size + GNUNET_DATASTORE_ENTRY_OVERHEAD);
- GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
"datastore-postgres",
- "Stored %u bytes in database\n",
+ "Stored %u bytes in database\n",
(unsigned int) size);
cont (cont_cls, key, size, GNUNET_OK, NULL);
}
* @param line line number for error messages
*/
static void
-process_result (struct Plugin *plugin,
+process_result (struct Plugin *plugin,
PluginDatumProcessor proc,
void *proc_cls,
PGresult * res,
};
if (GNUNET_OK !=
- GNUNET_POSTGRES_check_result_ (plugin->dbh,
- res,
- PGRES_TUPLES_OK,
+ GNUNET_POSTGRES_check_result_ (plugin->dbh,
+ res,
+ PGRES_TUPLES_OK,
"PQexecPrepared",
"select",
filename, line))
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
"datastore-postgres",
"Ending iteration (postgres error)\n");
- proc (proc_cls, NULL, 0, NULL, 0, 0, 0,
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0,
GNUNET_TIME_UNIT_ZERO_ABS, 0);
return;
}
if (0 == PQntuples (res))
{
/* no result */
- GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
"datastore-postgres",
"Ending iteration (no more results)\n");
- proc (proc_cls, NULL, 0, NULL, 0, 0, 0,
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0,
GNUNET_TIME_UNIT_ZERO_ABS, 0);
PQclear (res);
return;
}
- if (1 != PQntuples (res))
+ if (1 != PQntuples (res))
{
GNUNET_break (0);
proc (proc_cls, NULL, 0, NULL, 0, 0, 0,
GNUNET_break (0);
PQclear (res);
GNUNET_POSTGRES_delete_by_rowid (plugin->dbh,
- "delrow",
+ "delrow",
rowid);
- proc (proc_cls, NULL, 0, NULL, 0, 0, 0,
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0,
GNUNET_TIME_UNIT_ZERO_ABS, 0);
return;
}
- GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
"datastore-postgres",
"Found result of size %u bytes and type %u in database\n",
- (unsigned int) size,
+ (unsigned int) size,
(unsigned int) utype);
iret = proc (proc_cls,
&key,
size,
data,
- (enum GNUNET_BLOCK_Type) utype,
+ (enum GNUNET_BLOCK_Type) utype,
priority,
anonymity,
expiration_time,
if (iret == GNUNET_NO)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Processor asked for item %u to be removed.\n",
+ "Processor asked for item %u to be removed.\n",
(unsigned int) rowid);
- if (GNUNET_OK ==
- GNUNET_POSTGRES_delete_by_rowid (plugin->dbh,
- "delrow",
+ if (GNUNET_OK ==
+ GNUNET_POSTGRES_delete_by_rowid (plugin->dbh,
+ "delrow",
rowid))
{
- GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
"datastore-postgres",
"Deleting %u bytes from database\n",
(unsigned int) size);
plugin->env->duc (plugin->env->cls,
- (size + GNUNET_DATASTORE_ENTRY_OVERHEAD));
- GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
"datastore-postgres",
"Deleted %u bytes from database\n",
(unsigned int) size);
* @param proc_cls closure for iter
*/
static void
-postgres_plugin_get_key (void *cls,
+postgres_plugin_get_key (void *cls,
uint64_t offset,
const struct GNUNET_HashCode *key,
const struct GNUNET_HashCode *vhash,
{
if (NULL != vhash)
{
- struct GNUNET_PQ_QueryParam params[] = {
+ struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (key),
GNUNET_PQ_query_param_auto_from_type (vhash),
GNUNET_PQ_query_param_uint32 (&utype),
}
else
{
- struct GNUNET_PQ_QueryParam params[] = {
+ struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (key),
GNUNET_PQ_query_param_uint32 (&utype),
GNUNET_PQ_query_param_end
{
if (NULL != vhash)
{
- struct GNUNET_PQ_QueryParam params[] = {
+ struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (key),
GNUNET_PQ_query_param_auto_from_type (vhash),
GNUNET_PQ_query_param_end
}
else
{
- struct GNUNET_PQ_QueryParam params[] = {
+ struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (key),
GNUNET_PQ_query_param_end
};
}
if (GNUNET_OK !=
- GNUNET_POSTGRES_check_result (plugin->dbh,
+ GNUNET_POSTGRES_check_result (plugin->dbh,
ret,
- PGRES_TUPLES_OK,
- "PQexecParams",
+ PGRES_TUPLES_OK,
+ "PQexecParams",
"count"))
{
- proc (proc_cls, NULL, 0, NULL, 0, 0, 0,
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0,
GNUNET_TIME_UNIT_ZERO_ABS, 0);
return;
}
- if ( (PQntuples (ret) != 1) ||
+ if ( (PQntuples (ret) != 1) ||
(PQnfields (ret) != 1) ||
(PQgetlength (ret, 0, 0) != sizeof (uint64_t)))
{
GNUNET_break (0);
PQclear (ret);
- proc (proc_cls, NULL, 0, NULL, 0, 0, 0,
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0,
GNUNET_TIME_UNIT_ZERO_ABS, 0);
return;
}
PQclear (ret);
if (0 == total)
{
- proc (proc_cls, NULL, 0, NULL, 0, 0, 0,
+ proc (proc_cls, NULL, 0, NULL, 0, 0, 0,
GNUNET_TIME_UNIT_ZERO_ABS, 0);
return;
}
{
if (NULL != vhash)
{
- struct GNUNET_PQ_QueryParam params[] = {
+ struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (key),
- GNUNET_PQ_query_param_auto_from_type (&vhash),
+ GNUNET_PQ_query_param_auto_from_type (vhash),
GNUNET_PQ_query_param_uint32 (&utype),
GNUNET_PQ_query_param_uint64 (&limit_off),
GNUNET_PQ_query_param_end
}
else
{
- struct GNUNET_PQ_QueryParam params[] = {
+ struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (key),
GNUNET_PQ_query_param_uint32 (&utype),
GNUNET_PQ_query_param_uint64 (&limit_off),
{
if (NULL != vhash)
{
- struct GNUNET_PQ_QueryParam params[] = {
+ struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (key),
- GNUNET_PQ_query_param_auto_from_type (&vhash),
+ GNUNET_PQ_query_param_auto_from_type (vhash),
GNUNET_PQ_query_param_uint64 (&limit_off),
GNUNET_PQ_query_param_end
};
}
else
{
- struct GNUNET_PQ_QueryParam params[] = {
+ struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (key),
GNUNET_PQ_query_param_uint64 (&limit_off),
GNUNET_PQ_query_param_end
}
process_result (plugin,
proc,
- proc_cls,
- ret,
+ proc_cls,
+ ret,
__FILE__, __LINE__);
}
* @param proc_cls closure for @a proc
*/
static void
-postgres_plugin_get_zero_anonymity (void *cls,
+postgres_plugin_get_zero_anonymity (void *cls,
uint64_t offset,
enum GNUNET_BLOCK_Type type,
- PluginDatumProcessor proc,
+ PluginDatumProcessor proc,
void *proc_cls)
{
struct Plugin *plugin = cls;
uint32_t utype = type;
- struct GNUNET_PQ_QueryParam params[] = {
+ struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint32 (&utype),
GNUNET_PQ_query_param_uint64 (&offset),
GNUNET_PQ_query_param_end
"select_non_anonymous",
params);
- process_result (plugin,
+ process_result (plugin,
proc, proc_cls,
ret,
__FILE__, __LINE__);
* @param expiration expiration time for the content
* @param uid unique identifier for the datum;
* maybe 0 if no unique identifier is available
- * @return #GNUNET_SYSERR to abort the iteration,
+ * @return #GNUNET_SYSERR to abort the iteration,
* #GNUNET_OK to continue
* (continue on call to "next", of course),
* #GNUNET_NO to delete the item and continue (if supported)
const struct GNUNET_HashCode *key,
uint32_t size,
const void *data,
- enum GNUNET_BLOCK_Type type,
+ enum GNUNET_BLOCK_Type type,
uint32_t priority,
- uint32_t anonymity,
+ uint32_t anonymity,
struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
{
struct Plugin *plugin = rc->plugin;
int ret;
uint32_t oid = (uint32_t) uid;
- struct GNUNET_PQ_QueryParam params[] = {
+ struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint32 (&oid),
GNUNET_PQ_query_param_end
};
PGresult *qret;
- ret = rc->proc (rc->proc_cls,
- key,
- size, data,
+ ret = rc->proc (rc->proc_cls,
+ key,
+ size, data,
type,
- priority,
+ priority,
anonymity,
expiration, uid);
if (NULL == key)
"decrepl",
params);
if (GNUNET_OK !=
- GNUNET_POSTGRES_check_result (plugin->dbh,
- qret,
- PGRES_COMMAND_OK,
+ GNUNET_POSTGRES_check_result (plugin->dbh,
+ qret,
+ PGRES_COMMAND_OK,
"PQexecPrepared",
"decrepl"))
return GNUNET_SYSERR;
* @param proc_cls closure for @a proc
*/
static void
-postgres_plugin_get_replication (void *cls,
+postgres_plugin_get_replication (void *cls,
PluginDatumProcessor proc,
void *proc_cls)
{
rc.plugin = plugin;
rc.proc = proc;
rc.proc_cls = proc_cls;
- ret = PQexecPrepared (plugin->dbh,
+ ret = PQexecPrepared (plugin->dbh,
"select_replication_order", 0, NULL, NULL,
NULL, 1);
- process_result (plugin,
- &repl_proc,
- &rc,
- ret,
+ process_result (plugin,
+ &repl_proc,
+ &rc,
+ ret,
__FILE__, __LINE__);
}
* @param proc_cls closure for @a proc
*/
static void
-postgres_plugin_get_expiration (void *cls,
+postgres_plugin_get_expiration (void *cls,
PluginDatumProcessor proc,
void *proc_cls)
{
struct Plugin *plugin = cls;
struct GNUNET_TIME_Absolute now;
- struct GNUNET_PQ_QueryParam params[] = {
+ struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_absolute_time (&now),
GNUNET_PQ_query_param_end
};
* @param cons_cls continuation closure
*/
static void
-postgres_plugin_update (void *cls,
- uint64_t uid,
+postgres_plugin_update (void *cls,
+ uint64_t uid,
int delta,
struct GNUNET_TIME_Absolute expire,
PluginUpdateCont cont,
struct Plugin *plugin = cls;
uint32_t idelta = delta;
uint32_t oid = (uint32_t) uid;
- struct GNUNET_PQ_QueryParam params[] = {
+ struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint32 (&idelta),
GNUNET_PQ_query_param_absolute_time (&expire),
GNUNET_PQ_query_param_uint32 (&oid),
params);
if (GNUNET_OK !=
GNUNET_POSTGRES_check_result (plugin->dbh,
- ret,
- PGRES_COMMAND_OK,
- "PQexecPrepared",
+ ret,
+ PGRES_COMMAND_OK,
+ "PQexecPrepared",
"update"))
{
- cont (cont_cls,
- GNUNET_SYSERR,
+ cont (cont_cls,
+ GNUNET_SYSERR,
NULL);
return;
}
PQclear (ret);
- cont (cont_cls,
- GNUNET_OK,
+ cont (cont_cls,
+ GNUNET_OK,
NULL);
}
-
/**
* Get all of the keys in the datastore.
*
struct GNUNET_HashCode key;
PGresult * res;
- res = PQexecPrepared (plugin->dbh,
- "get_keys",
+ res = PQexecPrepared (plugin->dbh,
+ "get_keys",
0, NULL, NULL, NULL, 1);
ret = PQntuples (res);
for (i=0;i<ret;i++)
{
- if (sizeof (struct GNUNET_HashCode) !=
+ if (sizeof (struct GNUNET_HashCode) !=
PQgetlength (res, i, 0))
{
- memcpy (&key,
- PQgetvalue (res, i, 0),
+ memcpy (&key,
+ PQgetvalue (res, i, 0),
sizeof (struct GNUNET_HashCode));
proc (proc_cls, &key, 1);
}
}
-
/**
* Drop database.
*
{
struct Plugin *plugin = cls;
- if (GNUNET_OK !=
- GNUNET_POSTGRES_exec (plugin->dbh, "DROP TABLE gn090"))
- GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING,
- "postgres",
+ if (GNUNET_OK !=
+ GNUNET_POSTGRES_exec (plugin->dbh,
+ "DROP TABLE gn090"))
+ GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING,
+ "postgres",
_("Failed to drop table from database.\n"));
}
api->get_zero_anonymity = &postgres_plugin_get_zero_anonymity;
api->get_keys = &postgres_plugin_get_keys;
api->drop = &postgres_plugin_drop;
- GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, "datastore-postgres",
+ GNUNET_log_from (GNUNET_ERROR_TYPE_INFO,
+ "datastore-postgres",
_("Postgres database running\n"));
return api;
}