aboutsummaryrefslogtreecommitdiff
path: root/src/datastore/gnunet-datastore.c
diff options
context:
space:
mode:
authorDavid Barksdale <amatus@amat.us>2017-03-22 22:17:05 -0500
committerDavid Barksdale <amatus@amat.us>2017-03-22 22:19:13 -0500
commit78ecfccd774a77ae3d7a51e3f5c7c7c86cf7985b (patch)
tree1dc23a2f6d78c8026e69181ac90055929d79bba8 /src/datastore/gnunet-datastore.c
parentaa98f144e6db0da5a0a4cad83fe64a80bbab6692 (diff)
downloadgnunet-78ecfccd774a77ae3d7a51e3f5c7c7c86cf7985b.tar.gz
gnunet-78ecfccd774a77ae3d7a51e3f5c7c7c86cf7985b.zip
[datastore] Return and update replication
This fixes a couple FIXMEs in the datastore code. The replication value is now returned from the datastore and the update function can increase the replication.
Diffstat (limited to 'src/datastore/gnunet-datastore.c')
-rw-r--r--src/datastore/gnunet-datastore.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/src/datastore/gnunet-datastore.c b/src/datastore/gnunet-datastore.c
index c93bc8dd3..7caf5d175 100644
--- a/src/datastore/gnunet-datastore.c
+++ b/src/datastore/gnunet-datastore.c
@@ -130,20 +130,23 @@ do_finish (void *cls,
130 * @param type type of the content 130 * @param type type of the content
131 * @param priority priority of the content 131 * @param priority priority of the content
132 * @param anonymity anonymity-level for the content 132 * @param anonymity anonymity-level for the content
133 * @param replication replication-level for the content
133 * @param expiration expiration time for the content 134 * @param expiration expiration time for the content
134 * @param uid unique identifier for the datum; 135 * @param uid unique identifier for the datum;
135 * maybe 0 if no unique identifier is available 136 * maybe 0 if no unique identifier is available
136 */ 137 */
137static void 138static void
138do_put (void *cls, 139do_put (void *cls,
139 const struct GNUNET_HashCode *key, 140 const struct GNUNET_HashCode *key,
140 size_t size, 141 size_t size,
141 const void *data, 142 const void *data,
142 enum GNUNET_BLOCK_Type type, 143 enum GNUNET_BLOCK_Type type,
143 uint32_t priority, 144 uint32_t priority,
144 uint32_t anonymity, 145 uint32_t anonymity,
145 struct GNUNET_TIME_Absolute 146 uint32_t replication,
146 expiration, uint64_t uid) 147 struct GNUNET_TIME_Absolute
148 expiration,
149 uint64_t uid)
147{ 150{
148 qe = NULL; 151 qe = NULL;
149 if ( (0 != offset) && 152 if ( (0 != offset) &&
@@ -154,13 +157,20 @@ do_put (void *cls,
154 } 157 }
155 if (0 == offset) 158 if (0 == offset)
156 first_uid = uid; 159 first_uid = uid;
157 qe = GNUNET_DATASTORE_put (db_dst, 0, 160 qe = GNUNET_DATASTORE_put (db_dst,
158 key, size, data, type, 161 0,
159 priority, anonymity, 162 key,
160 0 /* FIXME: replication is lost... */, 163 size,
161 expiration, 164 data,
162 0, 1, 165 type,
163 &do_finish, NULL); 166 priority,
167 anonymity,
168 replication,
169 expiration,
170 0,
171 1,
172 &do_finish,
173 NULL);
164} 174}
165 175
166 176