finishing first run at unindex
authorChristian Grothoff <christian@grothoff.org>
Wed, 2 Sep 2009 19:55:10 +0000 (19:55 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 2 Sep 2009 19:55:10 +0000 (19:55 +0000)
src/fs/fs_unindex.c
src/include/gnunet_fs_service.h

index a6d414f094afce4519faa8d6fe17b3ead6aad1f5..2d16e9aeea725f388f7e2576db6a484e754077ce 100644 (file)
@@ -144,29 +144,6 @@ unindex_process (void *cls,
                           uc,
                           GNUNET_CONSTANTS_SERVICE_TIMEOUT);
 }
-                                            
-
-/**
- * Function called with information about our
- * progress in computing the tree encoding.
- *
- * @param cls closure
- * @param offset where are we in the file
- * @param pt_block plaintext of the currently processed block
- * @param pt_size size of pt_block
- * @param depth depth of the block in the tree
- */
-static void
-unindex_progress (void *cls,
-                 uint64_t offset,
-                 const void *pt_block,
-                 size_t pt_size,
-                 unsigned int depth)
-{
-  struct GNUNET_FS_UnindexContext *uc = cls;
-  // FIXME: call callback!
-}
-                                              
 
 
 /**
@@ -194,6 +171,38 @@ make_unindex_status (struct GNUNET_FS_ProgressInfo *pi,
 }
 
 
+/**
+ * Function called with information about our
+ * progress in computing the tree encoding.
+ *
+ * @param cls closure
+ * @param offset where are we in the file
+ * @param pt_block plaintext of the currently processed block
+ * @param pt_size size of pt_block
+ * @param depth depth of the block in the tree
+ */
+static void
+unindex_progress (void *cls,
+                 uint64_t offset,
+                 const void *pt_block,
+                 size_t pt_size,
+                 unsigned int depth)
+{
+  struct GNUNET_FS_UnindexContext *uc = cls;
+  struct GNUNET_FS_ProgressInfo pi;
+
+  pi.status = GNUNET_FS_STATUS_UNINDEX_PROGRESS;
+  make_unindex_status (&pi, uc, offset);
+  pi.value.unindex.specifics.progress.data = pt_block;
+  pi.value.unindex.specifics.progress.offset = offset;
+  pi.value.unindex.specifics.progress.data_len = pt_size;
+  pi.value.unindex.specifics.progress.depth = depth;
+  uc->client_info 
+    = uc->h->upcb (uc->h->upcb_cls,
+                  &pi);
+}
+                                              
+
 /**
  * We've encountered an error during
  * unindexing.  Signal the client.
index 8f7c67407335f0ae50eaae7df09eb9cd98672500..e8b8d0ba0460773e8e46b55aef977e66340e477c 100644 (file)
@@ -919,6 +919,14 @@ struct GNUNET_FS_ProgressInfo
           */
          uint64_t data_len;
 
+         /**
+          * Depth of the given block in the tree; 
+          * 0 would be the highest level (the first
+          * call is guaranteed to be for the lowest
+          * level).
+          */
+         unsigned int depth;
+
          /**
           * Amount of trust we offered to get the block.
           */
@@ -1327,6 +1335,14 @@ struct GNUNET_FS_ProgressInfo
           */
          uint64_t data_len;
 
+         /**
+          * Depth of the given block in the tree; 
+          * 0 would be the highest level (the first
+          * call is guaranteed to be for the lowest
+          * level).
+          */
+         unsigned int depth;
+
        } progress;
 
        /**