- fixed string to address parsing
[oweals/gnunet.git] / src / fs / fs_api.h
index 1d18e20bc7625fb22c3e77b1defe7767b311a0a6..e75b75f417fb0d959665189bbbf338a102143e7b 100644 (file)
@@ -733,6 +733,24 @@ void
 GNUNET_FS_unindex_process_hash_ (void *cls, const GNUNET_HashCode * file_id);
 
 
+/**
+ * Extract the keywords for KBlock removal
+ *
+ * @param uc context for the unindex operation.
+ */
+void
+GNUNET_FS_unindex_do_extract_keywords_ (struct GNUNET_FS_UnindexContext *uc);
+
+
+/**
+ * If necessary, connect to the datastore and remove the KBlocks.
+ *
+ * @param uc context for the unindex operation.
+ */
+void
+GNUNET_FS_unindex_do_remove_kblocks_ (struct GNUNET_FS_UnindexContext *uc);
+
+
 /**
  * Fill in all of the generic fields for a publish event and call the
  * callback.
@@ -1244,32 +1262,42 @@ struct GNUNET_FS_PublishContext
  */
 enum UnindexState
 {
-    /**
-     * We're currently hashing the file.
-     */
+  /**
+   * We're currently hashing the file.
+   */
   UNINDEX_STATE_HASHING = 0,
 
-    /**
-     * We're telling the datastore to delete
-     * the respective entries.
-     */
+  /**
+   * We're telling the datastore to delete
+   * the respective DBlocks and IBlocks.
+   */
   UNINDEX_STATE_DS_REMOVE = 1,
+  
+  /**
+   * Find out which keywords apply.
+   */
+  UNINDEX_STATE_EXTRACT_KEYWORDS = 2,
 
-    /**
-     * We're notifying the FS service about
-     * the unindexing.
-     */
-  UNINDEX_STATE_FS_NOTIFY = 2,
-
-    /**
-     * We're done.
-     */
-  UNINDEX_STATE_COMPLETE = 3,
+  /**
+   * We're telling the datastore to remove KBlocks.
+   */
+  UNINDEX_STATE_DS_REMOVE_KBLOCKS = 3,
 
-    /**
-     * We've encountered a fatal error.
-     */
-  UNINDEX_STATE_ERROR = 4
+  /**
+   * We're notifying the FS service about
+   * the unindexing.
+   */
+  UNINDEX_STATE_FS_NOTIFY = 4,
+  
+  /**
+   * We're done.
+   */
+  UNINDEX_STATE_COMPLETE = 5,
+  
+  /**
+   * We've encountered a fatal error.
+   */
+  UNINDEX_STATE_ERROR = 6
 };
 
 
@@ -1279,6 +1307,12 @@ enum UnindexState
 struct GNUNET_FS_UnindexContext
 {
 
+  /**
+   * The content hash key of the last block we processed, will in the
+   * end be set to the CHK from the URI.  Used to remove the KBlocks.
+   */
+  struct ContentHashKey chk; 
+
   /**
    * Global FS context.
    */
@@ -1289,6 +1323,21 @@ struct GNUNET_FS_UnindexContext
    */
   struct TopLevelActivity *top;
 
+  /**
+   * Directory scanner to find keywords (KBlock removal).
+   */
+  struct GNUNET_FS_DirScanner *dscan;
+
+  /**
+   * Keywords found (telling us which KBlocks to remove).
+   */
+  struct GNUNET_FS_Uri *ksk_uri;
+
+  /**
+   * Current offset in KSK removal.
+   */
+  uint32_t ksk_offset;
+
   /**
    * Name of the file that we are unindexing.
    */
@@ -1326,6 +1375,27 @@ struct GNUNET_FS_UnindexContext
    */
   struct GNUNET_DISK_FileHandle *fh;
 
+  /**
+   * Handle to datastore 'get_key' operation issued for
+   * obtaining KBlocks.
+   */
+  struct GNUNET_DATASTORE_QueueEntry *dqe;
+
+  /**
+   * Current key for decrypting KBLocks from 'get_key' operation.
+   */
+  GNUNET_HashCode key;
+
+  /**
+   * Current query of 'get_key' operation.
+   */
+  GNUNET_HashCode query;
+
+  /**
+   * First content UID, 0 for none.
+   */
+  uint64_t first_uid;
+
   /**
    * Error message, NULL on success.
    */
@@ -1341,6 +1411,11 @@ struct GNUNET_FS_UnindexContext
    */
   uint64_t file_size;
 
+  /**
+   * Random offset given to 'GNUNET_DATASTORE_get_key'.
+   */
+  uint64_t roff;
+
   /**
    * When did we start?
    */