Merge branch 'master' of ssh://gnunet.org/gnunet
[oweals/gnunet.git] / src / fs / fs_api.h
index 0e1476f5c9c8a5fc81c69c48b59a760602aa9552..be22ea73e7d8277bc636e9edb422443226424b73 100644 (file)
@@ -409,27 +409,6 @@ struct GNUNET_FS_FileInformation
 };
 
 
-/**
- * The job is now ready to run and should use the given client
- * handle to communicate with the FS service.
- *
- * @param cls closure
- * @param client handle to use for FS communication
- */
-typedef void
-(*GNUNET_FS_QueueStart) (void *cls,
-                         struct GNUNET_CLIENT_Connection *client);
-
-
-/**
- * The job must now stop to run and should destry the client handle as
- * soon as possible (ideally prior to returning).
- */
-typedef void
-(*GNUNET_FS_QueueStop) (void *cls);
-
-
-
 /**
  * Priorities for the queue.
  */
@@ -465,12 +444,12 @@ struct GNUNET_FS_QueueEntry
   /**
    * Function to call when the job is started.
    */
-  GNUNET_FS_QueueStart start;
+  GNUNET_SCHEDULER_TaskCallback start;
 
   /**
    * Function to call when the job needs to stop (or is done / dequeued).
    */
-  GNUNET_FS_QueueStop stop;
+  GNUNET_SCHEDULER_TaskCallback stop;
 
   /**
    * Closure for start and stop.
@@ -483,9 +462,9 @@ struct GNUNET_FS_QueueEntry
   struct GNUNET_FS_Handle *h;
 
   /**
-   * Client handle, or NULL if job is not running.
+   * Message queue handle, or NULL if job is not running.
    */
-  struct GNUNET_CLIENT_Connection *client;
+  struct GNUNET_MQ_Handle *mq;
 
   /**
    * Time the job was originally queued.
@@ -518,6 +497,11 @@ struct GNUNET_FS_QueueEntry
    */
   unsigned int start_times;
 
+  /**
+   * #GNUNET_YES if the job is active now.
+   */
+  int active;
+
 };
 
 
@@ -658,8 +642,8 @@ struct GNUNET_FS_SearchResult
  */
 struct GNUNET_FS_QueueEntry *
 GNUNET_FS_queue_ (struct GNUNET_FS_Handle *h,
-                  GNUNET_FS_QueueStart start,
-                  GNUNET_FS_QueueStop stop,
+                  GNUNET_SCHEDULER_TaskCallback start,
+                  GNUNET_SCHEDULER_TaskCallback stop,
                   void *cls,
                   unsigned int blocks,
                  enum GNUNET_FS_QueuePriority priority);
@@ -1218,11 +1202,6 @@ struct GNUNET_FS_PublishContext
    */
   struct GNUNET_FS_Handle *h;
 
-  /**
-   * Connection to FS service (only used for LOC URI signing).
-   */
-  struct GNUNET_CLIENT_Handle *fs_client;
-
   /**
    * Our top-level activity entry (if we are top-level, otherwise NULL).
    */
@@ -1255,10 +1234,10 @@ struct GNUNET_FS_PublishContext
   char *serialization;
 
   /**
-   * Our own client handle for the FS service; only briefly used when
+   * Our own message queue for the FS service; only briefly used when
    * we start to index a file, otherwise NULL.
    */
-  struct GNUNET_CLIENT_Connection *client;
+  struct GNUNET_MQ_Handle *mq;
 
   /**
    * Current position in the file-tree for the upload.
@@ -1435,7 +1414,7 @@ struct GNUNET_FS_UnindexContext
    * Connection to the FS service, only valid during the
    * #UNINDEX_STATE_FS_NOTIFY phase.
    */
-  struct GNUNET_CLIENT_Connection *client;
+  struct GNUNET_MQ_Handle *mq;
 
   /**
    * Connection to the datastore service, only valid during the
@@ -1484,21 +1463,11 @@ struct GNUNET_FS_UnindexContext
    */
   struct GNUNET_CRYPTO_FileHashContext *fhc;
 
-  /**
-   * Which values have we seen already?
-   */
-  struct GNUNET_CONTAINER_MultiHashMap *seen_dh;
-
   /**
    * Overall size of the file.
    */
   uint64_t file_size;
 
-  /**
-   * Random offset given to #GNUNET_DATASTORE_get_key.
-   */
-  uint64_t roff;
-
   /**
    * When did we start?
    */
@@ -1587,7 +1556,7 @@ struct GNUNET_FS_SearchContext
   /**
    * Connection to the FS service.
    */
-  struct GNUNET_CLIENT_Connection *client;
+  struct GNUNET_MQ_Handle *mq;
 
   /**
    * Pointer we keep for the client.
@@ -1636,18 +1605,6 @@ struct GNUNET_FS_SearchContext
    */
   struct GNUNET_SCHEDULER_Task *task;
 
-  /**
-   * How many of the entries in the search request
-   * map have been passed to the service so far?
-   */
-  unsigned int search_request_map_offset;
-
-  /**
-   * How many of the keywords in the KSK
-   * map have been passed to the service so far?
-   */
-  unsigned int keyword_offset;
-
   /**
    * Anonymity level for the search.
    */
@@ -1740,15 +1697,6 @@ enum BlockRequestState
  */
 struct DownloadRequest
 {
-  /**
-   * While pending, we keep all download requests in a doubly-linked list.
-   */
-  struct DownloadRequest *next;
-
-  /**
-   * While pending, we keep all download requests in a doubly-linked list.
-   */
-  struct DownloadRequest *prev;
 
   /**
    * Parent in the CHK-tree.
@@ -1774,7 +1722,7 @@ struct DownloadRequest
   uint64_t offset;
 
   /**
-   * Number of entries in 'children' array.
+   * Number of entries in @e children array.
    */
   unsigned int num_children;
 
@@ -1793,11 +1741,6 @@ struct DownloadRequest
    */
   enum BlockRequestState state;
 
-  /**
-   * #GNUNET_YES if this entry is in the pending list.
-   */
-  int is_pending;
-
 };
 
 
@@ -1838,7 +1781,7 @@ struct GNUNET_FS_DownloadContext
   /**
    * Connection to the FS service.
    */
-  struct GNUNET_CLIENT_Connection *client;
+  struct GNUNET_MQ_Handle *mq;
 
   /**
    * Parent download (used when downloading files
@@ -1916,12 +1859,6 @@ struct GNUNET_FS_DownloadContext
    */
   struct GNUNET_FS_QueueEntry *job_queue;
 
-  /**
-   * Non-NULL if we are currently having a request for
-   * transmission pending with the client handle.
-   */
-  struct GNUNET_CLIENT_TransmitHandle *th;
-
   /**
    * Tree encoder used for the reconstruction.
    */
@@ -1939,16 +1876,6 @@ struct GNUNET_FS_DownloadContext
    */
   struct GNUNET_CONTAINER_MultiHashMap *active;
 
-  /**
-   * Head of linked list of pending requests.
-   */
-  struct DownloadRequest *pending_head;
-
-  /**
-   * Head of linked list of pending requests.
-   */
-  struct DownloadRequest *pending_tail;
-
   /**
    * Top-level download request.
    */
@@ -2028,11 +1955,6 @@ struct GNUNET_FS_DownloadContext
    */
   int has_finished;
 
-  /**
-   * Have we started the receive continuation yet?
-   */
-  int in_receive;
-
   /**
    * Are we ready to issue requests (reconstructions are finished)?
    */