aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs_api.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-03-09 15:16:20 +0000
committerChristian Grothoff <christian@grothoff.org>2012-03-09 15:16:20 +0000
commit27b9c06bc5b0432f1522353da36502687dcb3cd6 (patch)
tree7109cd4c1757825ee515d4a007d0285df71dca73 /src/fs/fs_api.h
parent0fb1248fdd6a348cb1e0b4f56e4a195226adccd3 (diff)
downloadgnunet-27b9c06bc5b0432f1522353da36502687dcb3cd6.tar.gz
gnunet-27b9c06bc5b0432f1522353da36502687dcb3cd6.zip
implementing removal of KBlocks during unindex operation (#1926)
Diffstat (limited to 'src/fs/fs_api.h')
-rw-r--r--src/fs/fs_api.h112
1 files changed, 91 insertions, 21 deletions
diff --git a/src/fs/fs_api.h b/src/fs/fs_api.h
index 1d18e20bc..924911b63 100644
--- a/src/fs/fs_api.h
+++ b/src/fs/fs_api.h
@@ -734,6 +734,24 @@ GNUNET_FS_unindex_process_hash_ (void *cls, const GNUNET_HashCode * file_id);
734 734
735 735
736/** 736/**
737 * Extract the keywords for KBlock removal
738 *
739 * @param uc context for the unindex operation.
740 */
741void
742GNUNET_FS_unindex_do_extract_keywords_ (struct GNUNET_FS_UnindexContext *uc);
743
744
745/**
746 * If necessary, connect to the datastore and remove the KBlocks.
747 *
748 * @param uc context for the unindex operation.
749 */
750void
751GNUNET_FS_unindex_do_remove_kblocks_ (struct GNUNET_FS_UnindexContext *uc);
752
753
754/**
737 * Fill in all of the generic fields for a publish event and call the 755 * Fill in all of the generic fields for a publish event and call the
738 * callback. 756 * callback.
739 * 757 *
@@ -1244,32 +1262,42 @@ struct GNUNET_FS_PublishContext
1244 */ 1262 */
1245enum UnindexState 1263enum UnindexState
1246{ 1264{
1247 /** 1265 /**
1248 * We're currently hashing the file. 1266 * We're currently hashing the file.
1249 */ 1267 */
1250 UNINDEX_STATE_HASHING = 0, 1268 UNINDEX_STATE_HASHING = 0,
1251 1269
1252 /** 1270 /**
1253 * We're telling the datastore to delete 1271 * We're telling the datastore to delete
1254 * the respective entries. 1272 * the respective DBlocks and IBlocks.
1255 */ 1273 */
1256 UNINDEX_STATE_DS_REMOVE = 1, 1274 UNINDEX_STATE_DS_REMOVE = 1,
1275
1276 /**
1277 * Find out which keywords apply.
1278 */
1279 UNINDEX_STATE_EXTRACT_KEYWORDS = 2,
1257 1280
1258 /** 1281 /**
1259 * We're notifying the FS service about 1282 * We're telling the datastore to remove KBlocks.
1260 * the unindexing. 1283 */
1261 */ 1284 UNINDEX_STATE_DS_REMOVE_KBLOCKS = 3,
1262 UNINDEX_STATE_FS_NOTIFY = 2,
1263
1264 /**
1265 * We're done.
1266 */
1267 UNINDEX_STATE_COMPLETE = 3,
1268 1285
1269 /** 1286 /**
1270 * We've encountered a fatal error. 1287 * We're notifying the FS service about
1271 */ 1288 * the unindexing.
1272 UNINDEX_STATE_ERROR = 4 1289 */
1290 UNINDEX_STATE_FS_NOTIFY = 4,
1291
1292 /**
1293 * We're done.
1294 */
1295 UNINDEX_STATE_COMPLETE = 5,
1296
1297 /**
1298 * We've encountered a fatal error.
1299 */
1300 UNINDEX_STATE_ERROR = 6
1273}; 1301};
1274 1302
1275 1303
@@ -1280,6 +1308,12 @@ struct GNUNET_FS_UnindexContext
1280{ 1308{
1281 1309
1282 /** 1310 /**
1311 * The content hash key of the last block we processed, will in the
1312 * end be set to the CHK from the URI. Used to remove the KBlocks.
1313 */
1314 struct ContentHashKey chk;
1315
1316 /**
1283 * Global FS context. 1317 * Global FS context.
1284 */ 1318 */
1285 struct GNUNET_FS_Handle *h; 1319 struct GNUNET_FS_Handle *h;
@@ -1290,6 +1324,21 @@ struct GNUNET_FS_UnindexContext
1290 struct TopLevelActivity *top; 1324 struct TopLevelActivity *top;
1291 1325
1292 /** 1326 /**
1327 * Directory scanner to find keywords (KBlock removal).
1328 */
1329 struct GNUNET_FS_DirScanner *dscan;
1330
1331 /**
1332 * Keywords found (telling us which KBlocks to remove).
1333 */
1334 struct GNUNET_FS_Uri *ksk_uri;
1335
1336 /**
1337 * Current offset in KSK removal.
1338 */
1339 uint32_t ksk_offset;
1340
1341 /**
1293 * Name of the file that we are unindexing. 1342 * Name of the file that we are unindexing.
1294 */ 1343 */
1295 char *filename; 1344 char *filename;
@@ -1327,6 +1376,22 @@ struct GNUNET_FS_UnindexContext
1327 struct GNUNET_DISK_FileHandle *fh; 1376 struct GNUNET_DISK_FileHandle *fh;
1328 1377
1329 /** 1378 /**
1379 * Handle to datastore 'get_key' operation issued for
1380 * obtaining KBlocks.
1381 */
1382 struct GNUNET_DATASTORE_QueueEntry *dqe;
1383
1384 /**
1385 * Current query key of 'get_key' operation.
1386 */
1387 GNUNET_HashCode key;
1388
1389 /**
1390 * First content UID, 0 for none.
1391 */
1392 uint64_t first_uid;
1393
1394 /**
1330 * Error message, NULL on success. 1395 * Error message, NULL on success.
1331 */ 1396 */
1332 char *emsg; 1397 char *emsg;
@@ -1342,6 +1407,11 @@ struct GNUNET_FS_UnindexContext
1342 uint64_t file_size; 1407 uint64_t file_size;
1343 1408
1344 /** 1409 /**
1410 * Random offset given to 'GNUNET_DATASTORE_get_key'.
1411 */
1412 uint64_t roff;
1413
1414 /**
1345 * When did we start? 1415 * When did we start?
1346 */ 1416 */
1347 struct GNUNET_TIME_Absolute start_time; 1417 struct GNUNET_TIME_Absolute start_time;