diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-09-04 08:12:54 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-09-04 08:12:54 +0000 |
commit | f8bfdee4d3a12ccc63b4f340b3032ae3b0ee5fd1 (patch) | |
tree | e7f08426d4d44a4e68d974f51155c739d9127ccb /src/fs/fs_unindex.c | |
parent | 0624f202f56751abbccb16f08031c03b20a921a9 (diff) | |
download | gnunet-f8bfdee4d3a12ccc63b4f340b3032ae3b0ee5fd1.tar.gz gnunet-f8bfdee4d3a12ccc63b4f340b3032ae3b0ee5fd1.zip |
towards search
Diffstat (limited to 'src/fs/fs_unindex.c')
-rw-r--r-- | src/fs/fs_unindex.c | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/src/fs/fs_unindex.c b/src/fs/fs_unindex.c index fb72c0167..23779bc97 100644 --- a/src/fs/fs_unindex.c +++ b/src/fs/fs_unindex.c | |||
@@ -79,54 +79,6 @@ unindex_reader (void *cls, | |||
79 | 79 | ||
80 | 80 | ||
81 | /** | 81 | /** |
82 | * Function called asking for the current (encoded) | ||
83 | * block to be processed. After processing the | ||
84 | * client should either call "GNUNET_FS_tree_encode_next" | ||
85 | * or (on error) "GNUNET_FS_tree_encode_finish". | ||
86 | * | ||
87 | * @param cls closure | ||
88 | * @param query the query for the block (key for lookup in the datastore) | ||
89 | * @param offset offset of the block | ||
90 | * @param type type of the block (IBLOCK or DBLOCK) | ||
91 | * @param block the (encrypted) block | ||
92 | * @param block_size size of block (in bytes) | ||
93 | */ | ||
94 | static void | ||
95 | unindex_process (void *cls, | ||
96 | const GNUNET_HashCode *query, | ||
97 | uint64_t offset, | ||
98 | unsigned int type, | ||
99 | const void *block, | ||
100 | uint16_t block_size) | ||
101 | { | ||
102 | struct GNUNET_FS_UnindexContext *uc = cls; | ||
103 | uint32_t size; | ||
104 | const void *data; | ||
105 | struct OnDemandBlock odb; | ||
106 | |||
107 | if (type != GNUNET_DATASTORE_BLOCKTYPE_DBLOCK) | ||
108 | { | ||
109 | size = block_size; | ||
110 | data = block; | ||
111 | } | ||
112 | else /* on-demand encoded DBLOCK */ | ||
113 | { | ||
114 | size = sizeof(struct OnDemandBlock); | ||
115 | odb.offset = offset; | ||
116 | odb.file_id = uc->file_id; | ||
117 | data = &odb; | ||
118 | } | ||
119 | GNUNET_DATASTORE_remove (uc->dsh, | ||
120 | query, | ||
121 | block_size, | ||
122 | block, | ||
123 | &process_cont, | ||
124 | uc, | ||
125 | GNUNET_CONSTANTS_SERVICE_TIMEOUT); | ||
126 | } | ||
127 | |||
128 | |||
129 | /** | ||
130 | * Fill in all of the generic fields for | 82 | * Fill in all of the generic fields for |
131 | * an unindex event. | 83 | * an unindex event. |
132 | * | 84 | * |
@@ -223,7 +175,7 @@ process_cont (void *cls, | |||
223 | if (success == GNUNET_SYSERR) | 175 | if (success == GNUNET_SYSERR) |
224 | { | 176 | { |
225 | signal_unindex_error (uc, | 177 | signal_unindex_error (uc, |
226 | emsg); | 178 | msg); |
227 | return; | 179 | return; |
228 | } | 180 | } |
229 | 181 | ||
@@ -232,6 +184,54 @@ process_cont (void *cls, | |||
232 | 184 | ||
233 | 185 | ||
234 | /** | 186 | /** |
187 | * Function called asking for the current (encoded) | ||
188 | * block to be processed. After processing the | ||
189 | * client should either call "GNUNET_FS_tree_encode_next" | ||
190 | * or (on error) "GNUNET_FS_tree_encode_finish". | ||
191 | * | ||
192 | * @param cls closure | ||
193 | * @param query the query for the block (key for lookup in the datastore) | ||
194 | * @param offset offset of the block | ||
195 | * @param type type of the block (IBLOCK or DBLOCK) | ||
196 | * @param block the (encrypted) block | ||
197 | * @param block_size size of block (in bytes) | ||
198 | */ | ||
199 | static void | ||
200 | unindex_process (void *cls, | ||
201 | const GNUNET_HashCode *query, | ||
202 | uint64_t offset, | ||
203 | unsigned int type, | ||
204 | const void *block, | ||
205 | uint16_t block_size) | ||
206 | { | ||
207 | struct GNUNET_FS_UnindexContext *uc = cls; | ||
208 | uint32_t size; | ||
209 | const void *data; | ||
210 | struct OnDemandBlock odb; | ||
211 | |||
212 | if (type != GNUNET_DATASTORE_BLOCKTYPE_DBLOCK) | ||
213 | { | ||
214 | size = block_size; | ||
215 | data = block; | ||
216 | } | ||
217 | else /* on-demand encoded DBLOCK */ | ||
218 | { | ||
219 | size = sizeof(struct OnDemandBlock); | ||
220 | odb.offset = offset; | ||
221 | odb.file_id = uc->file_id; | ||
222 | data = &odb; | ||
223 | } | ||
224 | GNUNET_DATASTORE_remove (uc->dsh, | ||
225 | query, | ||
226 | block_size, | ||
227 | block, | ||
228 | &process_cont, | ||
229 | uc, | ||
230 | GNUNET_CONSTANTS_SERVICE_TIMEOUT); | ||
231 | } | ||
232 | |||
233 | |||
234 | /** | ||
235 | * Function called when the tree encoder has | 235 | * Function called when the tree encoder has |
236 | * processed all blocks. Clean up. | 236 | * processed all blocks. Clean up. |
237 | * | 237 | * |