gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r30152 - in gnunet/src: fs include


From: gnunet
Subject: [GNUnet-SVN] r30152 - in gnunet/src: fs include
Date: Fri, 11 Oct 2013 16:50:07 +0200

Author: grothoff
Date: 2013-10-11 16:50:07 +0200 (Fri, 11 Oct 2013)
New Revision: 30152

Modified:
   gnunet/src/fs/fs_api.c
   gnunet/src/fs/fs_api.h
   gnunet/src/fs/fs_publish.c
   gnunet/src/fs/fs_test_lib.c
   gnunet/src/fs/gnunet-daemon-fsprofiler.c
   gnunet/src/fs/gnunet-publish.c
   gnunet/src/fs/test_fs_download.c
   gnunet/src/fs/test_fs_download_persistence.c
   gnunet/src/fs/test_fs_list_indexed.c
   gnunet/src/fs/test_fs_publish.c
   gnunet/src/fs/test_fs_publish_persistence.c
   gnunet/src/fs/test_fs_search.c
   gnunet/src/fs/test_fs_search_persistence.c
   gnunet/src/fs/test_fs_search_probes.c
   gnunet/src/fs/test_fs_unindex.c
   gnunet/src/fs/test_fs_unindex_persistence.c
   gnunet/src/include/gnunet_fs_service.h
Log:
generate progress events when publishing directories (towards fixing #2230)

Modified: gnunet/src/fs/fs_api.c
===================================================================
--- gnunet/src/fs/fs_api.c      2013-10-11 14:49:51 UTC (rev 30151)
+++ gnunet/src/fs/fs_api.c      2013-10-11 14:50:07 UTC (rev 30152)
@@ -284,7 +284,7 @@
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "AD: %u, MP: %u; %d probes and %d downloads to start, will run 
again in %s\n",
              h->active_downloads,
-             h->max_parallel_requests, 
+             h->max_parallel_requests,
              num_probes_change,
              num_downloads_change,
              GNUNET_STRINGS_relative_time_to_string (restart_at, GNUNET_YES));
@@ -982,6 +982,8 @@
   case 4:                      /* directory */
     ret->is_directory = GNUNET_YES;
     if ((GNUNET_OK != GNUNET_BIO_read_int32 (rh, &dsize)) ||
+        (GNUNET_OK != GNUNET_BIO_read_int64 (rh, 
&ret->data.dir.contents_completed)) ||
+        (GNUNET_OK != GNUNET_BIO_read_int64 (rh, 
&ret->data.dir.contents_size)) ||
         (NULL == (ret->data.dir.dir_data = GNUNET_malloc_large (dsize))) ||
         (GNUNET_OK !=
          GNUNET_BIO_read (rh, "dir-data", ret->data.dir.dir_data, dsize)) ||
@@ -1335,6 +1337,8 @@
         (NULL == fi->data.dir.entries->serialization) )
       GNUNET_FS_file_information_sync_ (fi->data.dir.entries);
     if ((GNUNET_OK != GNUNET_BIO_write_int32 (wh, fi->data.dir.dir_size)) ||
+        (GNUNET_OK != GNUNET_BIO_write_int64 (wh, 
fi->data.dir.contents_completed)) ||
+        (GNUNET_OK != GNUNET_BIO_write_int64 (wh, fi->data.dir.contents_size)) 
||
         (GNUNET_OK !=
          GNUNET_BIO_write (wh, fi->data.dir.dir_data,
                            (uint32_t) fi->data.dir.dir_size)) ||

Modified: gnunet/src/fs/fs_api.h
===================================================================
--- gnunet/src/fs/fs_api.h      2013-10-11 14:49:51 UTC (rev 30151)
+++ gnunet/src/fs/fs_api.h      2013-10-11 14:50:07 UTC (rev 30152)
@@ -347,7 +347,7 @@
 
       /**
        * Has the service confirmed our INDEX_START request?
-       * GNUNET_YES if this step has been completed.
+       * #GNUNET_YES if this step has been completed.
        */
       int index_start_confirmed;
 
@@ -376,6 +376,16 @@
        */
       void *dir_data;
 
+      /**
+       * How much of the directory have we published (relative to @e 
contents_size).
+       */
+      uint64_t contents_completed;
+
+      /**
+       * Sum of all of the sizes of all of the files in the directory.
+       */
+      uint64_t contents_size;
+
     } dir;
 
   } data;
@@ -416,17 +426,17 @@
  * Priorities for the queue.
  */
 enum GNUNET_FS_QueuePriority
-  {
-    /**
-     * This is a probe (low priority).
-     */
-    GNUNET_FS_QUEUE_PRIORITY_PROBE,
+{
+  /**
+   * This is a probe (low priority).
+   */
+  GNUNET_FS_QUEUE_PRIORITY_PROBE,
 
-    /**
-     * Default priority.
-     */
-    GNUNET_FS_QUEUE_PRIORITY_NORMAL
-  };
+  /**
+   * Default priority.
+   */
+  GNUNET_FS_QUEUE_PRIORITY_NORMAL
+};
 
 
 /**
@@ -701,6 +711,7 @@
 GNUNET_FS_data_reader_copy_ (void *cls, uint64_t offset, size_t max, void *buf,
                              char **emsg);
 
+
 /**
  * Notification of FS that a search probe has made progress.
  * This function is used INSTEAD of the client's event handler
@@ -901,6 +912,7 @@
 void
 GNUNET_FS_file_information_sync_ (struct GNUNET_FS_FileInformation *f);
 
+
 /**
  * Synchronize this publishing struct with its mirror
  * on disk.  Note that all internal FS-operations that change
@@ -912,6 +924,7 @@
 void
 GNUNET_FS_publish_sync_ (struct GNUNET_FS_PublishContext *pc);
 
+
 /**
  * Synchronize this unindex struct with its mirror
  * on disk.  Note that all internal FS-operations that change
@@ -923,6 +936,7 @@
 void
 GNUNET_FS_unindex_sync_ (struct GNUNET_FS_UnindexContext *uc);
 
+
 /**
  * Synchronize this search struct with its mirror
  * on disk.  Note that all internal FS-operations that change
@@ -934,6 +948,7 @@
 void
 GNUNET_FS_search_sync_ (struct GNUNET_FS_SearchContext *sc);
 
+
 /**
  * Synchronize this search result with its mirror
  * on disk.  Note that all internal FS-operations that change
@@ -945,6 +960,7 @@
 void
 GNUNET_FS_search_result_sync_ (struct GNUNET_FS_SearchResult *sr);
 
+
 /**
  * Synchronize this download struct with its mirror
  * on disk.  Note that all internal FS-operations that change
@@ -956,6 +972,7 @@
 void
 GNUNET_FS_download_sync_ (struct GNUNET_FS_DownloadContext *dc);
 
+
 /**
  * Create SUSPEND event for the given publish operation
  * and then clean up our state (without stop signal).
@@ -965,6 +982,7 @@
 void
 GNUNET_FS_publish_signal_suspend_ (void *cls);
 
+
 /**
  * Create SUSPEND event for the given search operation
  * and then clean up our state (without stop signal).
@@ -974,6 +992,7 @@
 void
 GNUNET_FS_search_signal_suspend_ (void *cls);
 
+
 /**
  * Create SUSPEND event for the given download operation
  * and then clean up our state (without stop signal).
@@ -983,6 +1002,7 @@
 void
 GNUNET_FS_download_signal_suspend_ (void *cls);
 
+
 /**
  * Create SUSPEND event for the given unindex operation
  * and then clean up our state (without stop signal).
@@ -992,6 +1012,7 @@
 void
 GNUNET_FS_unindex_signal_suspend_ (void *cls);
 
+
 /**
  * Function signature of the functions that can be called
  * to trigger suspend signals and clean-up for top-level
@@ -1034,11 +1055,12 @@
  *
  * @param h global fs handle
  * @param ssf suspend signal function to use
- * @param ssf_cls closure for ssf
+ * @param ssf_cls closure for @a ssf
  * @return fresh top-level activity handle
  */
 struct TopLevelActivity *
-GNUNET_FS_make_top (struct GNUNET_FS_Handle *h, SuspendSignalFunction ssf,
+GNUNET_FS_make_top (struct GNUNET_FS_Handle *h,
+                    SuspendSignalFunction ssf,
                     void *ssf_cls);
 
 
@@ -1049,7 +1071,8 @@
  * @param top top level activity entry
  */
 void
-GNUNET_FS_end_top (struct GNUNET_FS_Handle *h, struct TopLevelActivity *top);
+GNUNET_FS_end_top (struct GNUNET_FS_Handle *h,
+                   struct TopLevelActivity *top);
 
 
 
@@ -1256,13 +1279,13 @@
   int rid;
 
   /**
-   * Set to GNUNET_YES if all processing has completed.
+   * Set to #GNUNET_YES if all processing has completed.
    */
   int all_done;
 
   /**
-   * Flag set to GNUNET_YES if the next callback from
-   * GNUNET_FS_file_information_inspect should be skipped because it
+   * Flag set to #GNUNET_YES if the next callback from
+   * #GNUNET_FS_file_information_inspect should be skipped because it
    * is for the directory which was already processed with the parent.
    */
   int skip_next_fi_callback;
@@ -1362,7 +1385,7 @@
 
   /**
    * Connection to the FS service, only valid during the
-   * UNINDEX_STATE_FS_NOTIFY phase.
+   * #UNINDEX_STATE_FS_NOTIFY phase.
    */
   struct GNUNET_CLIENT_Connection *client;
 
@@ -1424,7 +1447,7 @@
   uint64_t file_size;
 
   /**
-   * Random offset given to 'GNUNET_DATASTORE_get_key'.
+   * Random offset given to #GNUNET_DATASTORE_get_key.
    */
   uint64_t roff;
 
@@ -1561,7 +1584,7 @@
   /**
    * ID of a task that is using this struct and that must be cancelled
    * when the search is being stopped (if not
-   * GNUNET_SCHEDULER_NO_TASK).  Used for the task that adds some
+   * #GNUNET_SCHEDULER_NO_TASK).  Used for the task that adds some
    * artificial delay when trying to reconnect to the FS service.
    */
   GNUNET_SCHEDULER_TaskIdentifier task;
@@ -1602,65 +1625,65 @@
  */
 enum BlockRequestState
 {
-    /**
-     * Initial state, block has only been allocated (since it is
-     * relevant to the overall download request).
-     */
+  /**
+   * Initial state, block has only been allocated (since it is
+   * relevant to the overall download request).
+   */
   BRS_INIT = 0,
 
-    /**
-     * We've checked the block on the path down the tree, and the
-     * content on disk did match the desired CHK, but not all
-     * the way down, so at the bottom some blocks will still
-     * need to be reconstructed).
-     */
+  /**
+   * We've checked the block on the path down the tree, and the
+   * content on disk did match the desired CHK, but not all
+   * the way down, so at the bottom some blocks will still
+   * need to be reconstructed).
+   */
   BRS_RECONSTRUCT_DOWN = 1,
 
-    /**
-     * We've calculated the CHK bottom-up based on the meta data.
-     * This may work, but if it did we have to write the meta data to
-     * disk at the end (and we still need to check against the
-     * CHK set on top).
-     */
+  /**
+   * We've calculated the CHK bottom-up based on the meta data.
+   * This may work, but if it did we have to write the meta data to
+   * disk at the end (and we still need to check against the
+   * CHK set on top).
+   */
   BRS_RECONSTRUCT_META_UP = 2,
 
-    /**
-     * We've calculated the CHK bottom-up based on what we have on
-     * disk, which may not be what the desired CHK is.  If the
-     * reconstructed CHKs match whatever comes from above, we're
-     * done with the respective subtree.
-     */
+  /**
+   * We've calculated the CHK bottom-up based on what we have on
+   * disk, which may not be what the desired CHK is.  If the
+   * reconstructed CHKs match whatever comes from above, we're
+   * done with the respective subtree.
+   */
   BRS_RECONSTRUCT_UP = 3,
 
-    /**
-     * We've determined the real, desired CHK for this block
-     * (full tree reconstruction failed), request is now pending.
-     * If the CHK that bubbled up through reconstruction did match
-     * the top-level request, the state machine for the subtree
-     * would have moved to BRS_DOWNLOAD_UP.
-     */
+  /**
+   * We've determined the real, desired CHK for this block
+   * (full tree reconstruction failed), request is now pending.
+   * If the CHK that bubbled up through reconstruction did match
+   * the top-level request, the state machine for the subtree
+   * would have moved to BRS_DOWNLOAD_UP.
+   */
   BRS_CHK_SET = 4,
 
-    /**
-     * We've successfully downloaded this block, but the children
-     * still need to be either downloaded or verified (download
-     * request propagates down).  If the download fails, the
-     * state machine for this block may move to
-     * BRS_DOWNLOAD_ERROR instead.
-     */
+  /**
+   * We've successfully downloaded this block, but the children
+   * still need to be either downloaded or verified (download
+   * request propagates down).  If the download fails, the
+   * state machine for this block may move to
+   * BRS_DOWNLOAD_ERROR instead.
+   */
   BRS_DOWNLOAD_DOWN = 5,
 
-    /**
-     * This block and all of its children have been downloaded
-     * successfully (full completion propagates up).
-     */
+  /**
+   * This block and all of its children have been downloaded
+   * successfully (full completion propagates up).
+   */
   BRS_DOWNLOAD_UP = 6,
 
-    /**
-     * We got a block back that matched the query but did not hash to
-     * the key (malicious publisher or hash collision); this block
-     * can never be downloaded (error propagates up).
-     */
+  /**
+   * We got a block back that matched the query but did not hash to
+   * the key (malicious publisher or hash collision); this block
+   * can never be downloaded (error propagates up).
+   */
   BRS_ERROR = 7
 };
 
@@ -1724,7 +1747,7 @@
   enum BlockRequestState state;
 
   /**
-   * GNUNET_YES if this entry is in the pending list.
+   * #GNUNET_YES if this entry is in the pending list.
    */
   int is_pending;
 
@@ -1944,7 +1967,7 @@
 
   /**
    * Flag set upon transitive completion (includes child downloads).
-   * This flag is only set to GNUNET_YES for directories where all
+   * This flag is only set to #GNUNET_YES for directories where all
    * child-downloads have also completed (and signalled completion).
    */
   int has_finished;

Modified: gnunet/src/fs/fs_publish.c
===================================================================
--- gnunet/src/fs/fs_publish.c  2013-10-11 14:49:51 UTC (rev 30151)
+++ gnunet/src/fs/fs_publish.c  2013-10-11 14:50:07 UTC (rev 30152)
@@ -362,7 +362,7 @@
     if (UINT64_MAX == offset)
     {
       if (&GNUNET_FS_data_reader_file_ == p->data.file.reader)
-      {        
+      {
        /* force closing the file to avoid keeping too many files open */
        p->data.file.reader (p->data.file.reader_cls, offset, 0, NULL, NULL);
       }
@@ -390,7 +390,8 @@
  * @param tc scheduler's task context (not used)
  */
 static void
-encode_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+encode_cont (void *cls,
+             const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct GNUNET_FS_PublishContext *pc = cls;
   struct GNUNET_FS_FileInformation *p;
@@ -421,7 +422,7 @@
   }
   else
   {
-  /* final progress event */
+    /* final progress event */
     GNUNET_assert (NULL != p->chk_uri);
     flen = GNUNET_FS_uri_chk_get_file_size (p->chk_uri);
     pi.status = GNUNET_FS_STATUS_PUBLISH_PROGRESS;
@@ -454,8 +455,12 @@
  * @param block_size size of @a block (in bytes)
  */
 static void
-block_proc (void *cls, const struct ContentHashKey *chk, uint64_t offset,
-            unsigned int depth, enum GNUNET_BLOCK_Type type, const void *block,
+block_proc (void *cls,
+            const struct ContentHashKey *chk,
+            uint64_t offset,
+            unsigned int depth,
+            enum GNUNET_BLOCK_Type type,
+            const void *block,
             uint16_t block_size)
 {
   struct GNUNET_FS_PublishContext *pc = cls;
@@ -520,11 +525,14 @@
  * @param depth depth of the block in the tree, 0 for DBLOCK
  */
 static void
-progress_proc (void *cls, uint64_t offset, const void *pt_block, size_t 
pt_size,
+progress_proc (void *cls, uint64_t offset,
+               const void *pt_block,
+               size_t pt_size,
                unsigned int depth)
 {
   struct GNUNET_FS_PublishContext *pc = cls;
   struct GNUNET_FS_FileInformation *p;
+  struct GNUNET_FS_FileInformation *par;
   struct GNUNET_FS_ProgressInfo pi;
 
   p = pc->fi_pos;
@@ -534,6 +542,23 @@
   pi.value.publish.specifics.progress.data_len = pt_size;
   pi.value.publish.specifics.progress.depth = depth;
   p->client_info = GNUNET_FS_publish_make_status_ (&pi, pc, p, offset);
+  if ( (0 != depth) ||
+       (GNUNET_YES == p->is_directory) )
+    return;
+  while (NULL != (par = p->dir))
+  {
+    p = par;
+    GNUNET_assert (GNUNET_YES == par->is_directory);
+    p->data.dir.contents_completed += pt_size;
+    pi.status = GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY;
+    pi.value.publish.specifics.progress_directory.completed = 
p->data.dir.contents_completed;
+    pi.value.publish.specifics.progress_directory.total = 
p->data.dir.contents_size;
+    pi.value.publish.specifics.progress_directory.eta = 
GNUNET_TIME_calculate_eta (p->start_time,
+                                                                               
    p->data.dir.contents_completed,
+                                                                               
    p->data.dir.contents_size);
+    p->client_info = GNUNET_FS_publish_make_status_ (&pi, pc, p, 0);
+
+  }
 }
 
 
@@ -1137,6 +1162,25 @@
 
 
 /**
+ * Calculate the total size of all of the files in the directory structure.
+ *
+ * @param fi file structure to traverse
+ */
+static uint64_t
+compute_contents_size (struct GNUNET_FS_FileInformation *fi)
+{
+  struct GNUNET_FS_FileInformation *ent;
+
+  if (GNUNET_YES != fi->is_directory)
+    return fi->data.file.file_size;
+  fi->data.dir.contents_size = 0;
+  for (ent = fi->data.dir.entries; NULL != ent; ent = ent->next)
+    fi->data.dir.contents_size += compute_contents_size (ent);
+  return fi->data.dir.contents_size;
+}
+
+
+/**
  * Publish a file or directory.
  *
  * @param h handle to the file sharing subsystem
@@ -1161,6 +1205,7 @@
   struct GNUNET_DATASTORE_Handle *dsh;
 
   GNUNET_assert (NULL != h);
+  compute_contents_size (fi);
   if (0 == (options & GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY))
   {
     dsh = GNUNET_DATASTORE_connect (h->cfg);

Modified: gnunet/src/fs/fs_test_lib.c
===================================================================
--- gnunet/src/fs/fs_test_lib.c 2013-10-11 14:49:51 UTC (rev 30151)
+++ gnunet/src/fs/fs_test_lib.c 2013-10-11 14:50:07 UTC (rev 30152)
@@ -253,6 +253,8 @@
                   (unsigned long long) info->value.publish.completed,
                   (unsigned long long) info->value.publish.size);
     break;
+  case GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY:
+    break;
   case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS:
     if (po->verbose)
       GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Download at %llu/%llu bytes\n",

Modified: gnunet/src/fs/gnunet-daemon-fsprofiler.c
===================================================================
--- gnunet/src/fs/gnunet-daemon-fsprofiler.c    2013-10-11 14:49:51 UTC (rev 
30151)
+++ gnunet/src/fs/gnunet-daemon-fsprofiler.c    2013-10-11 14:50:07 UTC (rev 
30152)
@@ -385,6 +385,9 @@
   case GNUNET_FS_STATUS_PUBLISH_PROGRESS:
     p = info->value.publish.cctx;
     return p;
+  case GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY:
+    p = info->value.publish.cctx;
+    return p;
   case GNUNET_FS_STATUS_PUBLISH_ERROR:
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                "Publishing failed\n");

Modified: gnunet/src/fs/gnunet-publish.c
===================================================================
--- gnunet/src/fs/gnunet-publish.c      2013-10-11 14:49:51 UTC (rev 30151)
+++ gnunet/src/fs/gnunet-publish.c      2013-10-11 14:50:07 UTC (rev 30152)
@@ -227,12 +227,25 @@
     {
       s = GNUNET_STRINGS_relative_time_to_string (info->value.publish.eta,
                                                  GNUNET_YES);
-      FPRINTF (stdout, _("Publishing `%s' at %llu/%llu (%s remaining)\n"),
+      FPRINTF (stdout,
+               _("Publishing `%s' at %llu/%llu (%s remaining)\n"),
                info->value.publish.filename,
                (unsigned long long) info->value.publish.completed,
                (unsigned long long) info->value.publish.size, s);
     }
     break;
+  case GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY:
+    if (verbose)
+    {
+      s = GNUNET_STRINGS_relative_time_to_string 
(info->value.publish.specifics.progress_directory.eta,
+                                                 GNUNET_YES);
+      FPRINTF (stdout,
+               _("Publishing `%s' at %llu/%llu (%s remaining)\n"),
+               info->value.publish.filename,
+               (unsigned long long) 
info->value.publish.specifics.progress_directory.completed,
+               (unsigned long long) 
info->value.publish.specifics.progress_directory.total, s);
+    }
+    break;
   case GNUNET_FS_STATUS_PUBLISH_ERROR:
     FPRINTF (stderr, _("Error publishing: %s.\n"),
              info->value.publish.specifics.error.message);

Modified: gnunet/src/fs/test_fs_download.c
===================================================================
--- gnunet/src/fs/test_fs_download.c    2013-10-11 14:49:51 UTC (rev 30151)
+++ gnunet/src/fs/test_fs_download.c    2013-10-11 14:50:07 UTC (rev 30152)
@@ -139,6 +139,8 @@
                (unsigned long long) event->value.publish.specifics.
                progress.offset);
     break;
+  case GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY:
+    break;
   case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
     fprintf (stdout,
             "Publishing complete, %llu kb/s.\n",

Modified: gnunet/src/fs/test_fs_download_persistence.c
===================================================================
--- gnunet/src/fs/test_fs_download_persistence.c        2013-10-11 14:49:51 UTC 
(rev 30151)
+++ gnunet/src/fs/test_fs_download_persistence.c        2013-10-11 14:50:07 UTC 
(rev 30152)
@@ -162,6 +162,8 @@
                (unsigned long long) event->value.publish.specifics.
                progress.offset);
     break;
+  case GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY:
+    break;
   case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
     printf ("Publishing complete, %llu kbps.\n",
             (unsigned long long) (FILESIZE * 1000000LL /

Modified: gnunet/src/fs/test_fs_list_indexed.c
===================================================================
--- gnunet/src/fs/test_fs_list_indexed.c        2013-10-11 14:49:51 UTC (rev 
30151)
+++ gnunet/src/fs/test_fs_list_indexed.c        2013-10-11 14:50:07 UTC (rev 
30152)
@@ -115,6 +115,9 @@
                (unsigned long long) event->value.publish.specifics.
                progress.offset);
     break;
+  case GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY:
+    ret = event->value.publish.cctx;
+    break;
   case GNUNET_FS_STATUS_PUBLISH_ERROR:
     ret = event->value.publish.cctx;
     FPRINTF (stderr, "Error publishing file: %s\n",

Modified: gnunet/src/fs/test_fs_publish.c
===================================================================
--- gnunet/src/fs/test_fs_publish.c     2013-10-11 14:49:51 UTC (rev 30151)
+++ gnunet/src/fs/test_fs_publish.c     2013-10-11 14:50:07 UTC (rev 30152)
@@ -101,6 +101,9 @@
                (unsigned long long) event->value.publish.specifics.
                progress.offset);
     break;
+  case GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY:
+    ret = event->value.publish.cctx;
+    break;
   case GNUNET_FS_STATUS_PUBLISH_ERROR:
     ret = event->value.publish.cctx;
     FPRINTF (stderr, "Error publishing file: %s\n",

Modified: gnunet/src/fs/test_fs_publish_persistence.c
===================================================================
--- gnunet/src/fs/test_fs_publish_persistence.c 2013-10-11 14:49:51 UTC (rev 
30151)
+++ gnunet/src/fs/test_fs_publish_persistence.c 2013-10-11 14:50:07 UTC (rev 
30152)
@@ -145,6 +145,9 @@
         (0 == strcmp ("publish-context-dir", event->value.publish.cctx)) )
       GNUNET_SCHEDULER_add_now (&abort_publish_task, NULL);
     break;
+  case GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY:
+    ret = event->value.publish.cctx;
+    return ret;
   case GNUNET_FS_STATUS_PUBLISH_PROGRESS:
     consider_restart (event->status);
     ret = event->value.publish.cctx;

Modified: gnunet/src/fs/test_fs_search.c
===================================================================
--- gnunet/src/fs/test_fs_search.c      2013-10-11 14:49:51 UTC (rev 30151)
+++ gnunet/src/fs/test_fs_search.c      2013-10-11 14:50:07 UTC (rev 30152)
@@ -59,7 +59,7 @@
 
 static void
 abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{                                      
+{
   if (NULL != publish)
   {
     GNUNET_FS_publish_stop (publish);
@@ -123,6 +123,8 @@
                (unsigned long long) event->value.publish.specifics.
                progress.offset);
     break;
+  case GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY:
+    break;
   case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
     kuri = GNUNET_FS_uri_ksk_create_from_args (1, keywords);
     start = GNUNET_TIME_absolute_get ();

Modified: gnunet/src/fs/test_fs_search_persistence.c
===================================================================
--- gnunet/src/fs/test_fs_search_persistence.c  2013-10-11 14:49:51 UTC (rev 
30151)
+++ gnunet/src/fs/test_fs_search_persistence.c  2013-10-11 14:50:07 UTC (rev 
30152)
@@ -160,6 +160,8 @@
                (unsigned long long) event->value.publish.specifics.
                progress.offset);
     break;
+  case GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY:
+    break;
   case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
     kuri = GNUNET_FS_uri_ksk_create_from_args (1, keywords);
     start = GNUNET_TIME_absolute_get ();

Modified: gnunet/src/fs/test_fs_search_probes.c
===================================================================
--- gnunet/src/fs/test_fs_search_probes.c       2013-10-11 14:49:51 UTC (rev 
30151)
+++ gnunet/src/fs/test_fs_search_probes.c       2013-10-11 14:50:07 UTC (rev 
30152)
@@ -122,6 +122,8 @@
                (unsigned long long) event->value.publish.specifics.
                progress.offset);
     break;
+  case GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY:
+    break;
   case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
     kuri = GNUNET_FS_uri_ksk_create_from_args (1, keywords);
     start = GNUNET_TIME_absolute_get ();

Modified: gnunet/src/fs/test_fs_unindex.c
===================================================================
--- gnunet/src/fs/test_fs_unindex.c     2013-10-11 14:49:51 UTC (rev 30151)
+++ gnunet/src/fs/test_fs_unindex.c     2013-10-11 14:50:07 UTC (rev 30152)
@@ -90,6 +90,8 @@
                (unsigned long long) event->value.publish.specifics.
                progress.offset);
     break;
+  case GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY:
+    break;
   case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
     printf ("Publishing complete, %llu kbps.\n",
             (unsigned long long) (FILESIZE * 1000000LL /

Modified: gnunet/src/fs/test_fs_unindex_persistence.c
===================================================================
--- gnunet/src/fs/test_fs_unindex_persistence.c 2013-10-11 14:49:51 UTC (rev 
30151)
+++ gnunet/src/fs/test_fs_unindex_persistence.c 2013-10-11 14:50:07 UTC (rev 
30152)
@@ -132,6 +132,8 @@
                (unsigned long long) event->value.publish.specifics.
                progress.offset);
     break;
+  case GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY:
+    break;
   case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
     printf ("Publishing complete, %llu kbps.\n",
             (unsigned long long) (FILESIZE * 1000000LL /

Modified: gnunet/src/include/gnunet_fs_service.h
===================================================================
--- gnunet/src/include/gnunet_fs_service.h      2013-10-11 14:49:51 UTC (rev 
30151)
+++ gnunet/src/include/gnunet_fs_service.h      2013-10-11 14:50:07 UTC (rev 
30152)
@@ -685,7 +685,13 @@
    * Notification that the unindexing of this file
    * was stopped (final event for this action).
    */
-  GNUNET_FS_STATUS_UNINDEX_STOPPED = 36
+  GNUNET_FS_STATUS_UNINDEX_STOPPED = 36,
+
+  /**
+   * Notification that we are making progress sharing a directory.
+   */
+  GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY = 37
+
 };
 
 
@@ -844,6 +850,33 @@
 
         /**
         * These values are only valid for
+        * #GNUNET_FS_STATUS_PUBLISH_DIRECTORY_PROGRESS events.
+        */
+        struct
+        {
+
+          /**
+          * How far are we along in the overall directory?
+          */
+          uint64_t completed;
+
+          /**
+          * How big do we estimate the entire directory to be?
+          */
+          uint64_t total;
+
+          /**
+           * At what time do we expect to finish the upload of the
+           * CONTENTS of the directory. (The direcory itself will take
+           * extra time, indicated with the "eta" member at the
+           * "publish"-level of this struct.)
+           */
+          struct GNUNET_TIME_Relative eta;
+
+        } progress_directory;
+
+        /**
+        * These values are only valid for
         * #GNUNET_FS_STATUS_PUBLISH_RESUME events.
         */
         struct




reply via email to

[Prev in Thread] Current Thread [Next in Thread]