diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-06-08 13:54:33 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-06-08 13:54:33 +0000 |
commit | bddb39798942db2d4a1603487ebbc13d6f5c60bd (patch) | |
tree | 61144cd0faecc2731f5ae457684eb884bd26fcb7 /src | |
parent | 63fb0c45a2053493183e3c37b9f0ede9ec5073e1 (diff) | |
download | gnunet-bddb39798942db2d4a1603487ebbc13d6f5c60bd.tar.gz gnunet-bddb39798942db2d4a1603487ebbc13d6f5c60bd.zip |
-doxygen
Diffstat (limited to 'src')
-rw-r--r-- | src/datastore/plugin_datastore_postgres.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c index 79217c998..54e5df375 100644 --- a/src/datastore/plugin_datastore_postgres.c +++ b/src/datastore/plugin_datastore_postgres.c | |||
@@ -65,7 +65,7 @@ struct Plugin | |||
65 | * @brief Get a database handle | 65 | * @brief Get a database handle |
66 | * | 66 | * |
67 | * @param plugin global context | 67 | * @param plugin global context |
68 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 68 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
69 | */ | 69 | */ |
70 | static int | 70 | static int |
71 | init_connection (struct Plugin *plugin) | 71 | init_connection (struct Plugin *plugin) |
@@ -75,6 +75,7 @@ init_connection (struct Plugin *plugin) | |||
75 | plugin->dbh = GNUNET_POSTGRES_connect (plugin->env->cfg, "datastore-postgres"); | 75 | plugin->dbh = GNUNET_POSTGRES_connect (plugin->env->cfg, "datastore-postgres"); |
76 | if (NULL == plugin->dbh) | 76 | if (NULL == plugin->dbh) |
77 | return GNUNET_SYSERR; | 77 | return GNUNET_SYSERR; |
78 | |||
78 | ret = | 79 | ret = |
79 | PQexec (plugin->dbh, | 80 | PQexec (plugin->dbh, |
80 | "CREATE TABLE gn090 (" " repl INTEGER NOT NULL DEFAULT 0," | 81 | "CREATE TABLE gn090 (" " repl INTEGER NOT NULL DEFAULT 0," |
@@ -86,16 +87,23 @@ init_connection (struct Plugin *plugin) | |||
86 | " hash BYTEA NOT NULL DEFAULT ''," | 87 | " hash BYTEA NOT NULL DEFAULT ''," |
87 | " vhash BYTEA NOT NULL DEFAULT ''," | 88 | " vhash BYTEA NOT NULL DEFAULT ''," |
88 | " value BYTEA NOT NULL DEFAULT '')" "WITH OIDS"); | 89 | " value BYTEA NOT NULL DEFAULT '')" "WITH OIDS"); |
89 | if ((ret == NULL) || ((PQresultStatus (ret) != PGRES_COMMAND_OK) && (0 != strcmp ("42P07", /* duplicate table */ | 90 | if ( (NULL == ret) || |
90 | PQresultErrorField | 91 | ((PQresultStatus (ret) != PGRES_COMMAND_OK) && |
91 | (ret, | 92 | (0 != strcmp ("42P07", /* duplicate table */ |
92 | PG_DIAG_SQLSTATE))))) | 93 | PQresultErrorField |
94 | (ret, | ||
95 | PG_DIAG_SQLSTATE))))) | ||
93 | { | 96 | { |
94 | (void) GNUNET_POSTGRES_check_result (plugin->dbh, ret, PGRES_COMMAND_OK, "CREATE TABLE", "gn090"); | 97 | (void) GNUNET_POSTGRES_check_result (plugin->dbh, |
98 | ret, | ||
99 | PGRES_COMMAND_OK, | ||
100 | "CREATE TABLE", | ||
101 | "gn090"); | ||
95 | PQfinish (plugin->dbh); | 102 | PQfinish (plugin->dbh); |
96 | plugin->dbh = NULL; | 103 | plugin->dbh = NULL; |
97 | return GNUNET_SYSERR; | 104 | return GNUNET_SYSERR; |
98 | } | 105 | } |
106 | |||
99 | if (PQresultStatus (ret) == PGRES_COMMAND_OK) | 107 | if (PQresultStatus (ret) == PGRES_COMMAND_OK) |
100 | { | 108 | { |
101 | if ((GNUNET_OK != | 109 | if ((GNUNET_OK != |
@@ -124,6 +132,7 @@ init_connection (struct Plugin *plugin) | |||
124 | } | 132 | } |
125 | } | 133 | } |
126 | PQclear (ret); | 134 | PQclear (ret); |
135 | |||
127 | ret = | 136 | ret = |
128 | PQexec (plugin->dbh, | 137 | PQexec (plugin->dbh, |
129 | "ALTER TABLE gn090 ALTER value SET STORAGE EXTERNAL"); | 138 | "ALTER TABLE gn090 ALTER value SET STORAGE EXTERNAL"); |
@@ -217,7 +226,7 @@ init_connection (struct Plugin *plugin) | |||
217 | * Get an estimate of how much space the database is | 226 | * Get an estimate of how much space the database is |
218 | * currently using. | 227 | * currently using. |
219 | * | 228 | * |
220 | * @param cls our "struct Plugin*" | 229 | * @param cls our `struct Plugin *` |
221 | * @return number of bytes used on disk | 230 | * @return number of bytes used on disk |
222 | */ | 231 | */ |
223 | static unsigned long long | 232 | static unsigned long long |
@@ -257,7 +266,7 @@ postgres_plugin_estimate_size (void *cls) | |||
257 | /** | 266 | /** |
258 | * Store an item in the datastore. | 267 | * Store an item in the datastore. |
259 | * | 268 | * |
260 | * @param cls closure with the 'struct Plugin' | 269 | * @param cls closure with the `struct Plugin` |
261 | * @param key key for the item | 270 | * @param key key for the item |
262 | * @param size number of bytes in data | 271 | * @param size number of bytes in data |
263 | * @param data content stored | 272 | * @param data content stored |
@@ -267,7 +276,7 @@ postgres_plugin_estimate_size (void *cls) | |||
267 | * @param replication replication-level for the content | 276 | * @param replication replication-level for the content |
268 | * @param expiration expiration time for the content | 277 | * @param expiration expiration time for the content |
269 | * @param msg set to error message | 278 | * @param msg set to error message |
270 | * @return GNUNET_OK on success | 279 | * @return #GNUNET_OK on success |
271 | */ | 280 | */ |
272 | static int | 281 | static int |
273 | postgres_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t size, | 282 | postgres_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t size, |