todo
authorChristian Grothoff <christian@grothoff.org>
Sat, 29 Aug 2009 21:47:57 +0000 (21:47 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sat, 29 Aug 2009 21:47:57 +0000 (21:47 +0000)
src/fs/fs_publish.c
src/include/gnunet_fs_service.h

index 34d478b85dcc786b28d2b90547f6b260843d9d4e..124f737433c80eef2381c5ca616b2686a37d4468 100644 (file)
@@ -257,13 +257,18 @@ publish_sblock (struct GNUNET_FS_PublishContext *sc)
 {
   struct GNUNET_FS_FileInformation *p;
   p = sc->fi;
-
-  // FIXME: build sblock & call publish_block!
   
-  // FIXME: continuation should
-  // be releasing the datastore reserve
-  // (once implemented)
-  // FIXME: finally, signal overall completion
+  if (NULL != sc->namespace)
+    GNUNET_FS_publish_sks (sc->h,
+                          sc->namespace,
+                          sc->nid,
+                          sc->nuid,
+                          p->meta,
+                          p->chk_uri,
+                          p->expirationTime,
+                          p->anonymity,
+                          p->priority);
+  // FIXME: release the datastore reserve here!
   signal_publish_completion (p, sc);
 }
 
@@ -282,15 +287,28 @@ static void
 publish_kblocks (struct GNUNET_FS_PublishContext *sc,
                 struct GNUNET_FS_FileInformation *p)
 {
-  // FIXME: build all kblocks
-  // call publish_block on each
-
+  unsigned int i;
 
+  // FIXME: use cps here instead...
+  for (i=0;i<p->keywords->data.ksk.keywordCount;i++)
+    GNUNET_FS_publish_ksk (sc->h,
+                          p->keywords->data.ksk.keywords[i],
+                          p->meta,
+                          p->chk_uri,
+                          p->expirationTime,
+                          p->anonymity,
+                          p->priority);
   GNUNET_FS_file_information_sync (p);
   if (NULL != p->dir)
     signal_publish_completion (p, sc);
-
-  // last continuation should then call the main continuation again
+  sc->upload_task 
+    = GNUNET_SCHEDULER_add_delayed (sc->h->sched,
+                                   GNUNET_NO,
+                                   GNUNET_SCHEDULER_PRIORITY_BACKGROUND,
+                                   GNUNET_SCHEDULER_NO_TASK,
+                                   GNUNET_TIME_UNIT_ZERO,
+                                   &do_upload,
+                                   sc);
 }
 
 
@@ -832,4 +850,58 @@ GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *sc)
 }
 
 
+/**
+ * Publish a KBlock on GNUnet.
+ *
+ * @param h handle to the file sharing subsystem
+ * @param keyword keyword to use
+ * @param meta metadata to use
+ * @param uri URI to refer to in the KBlock
+ * @param expirationTime when the KBlock expires
+ * @param anonymity anonymity level for the KBlock
+ * @param priority priority for the KBlock
+ */
+// FIXME: cps this one
+void
+GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h,
+                      const char *keyword,
+                      struct GNUNET_CONTAINER_MetaData *meta,
+                      struct GNUNET_FS_Uri *uri,
+                      struct GNUNET_TIME_Absolute expirationTime,
+                      unsigned int anonymity,
+                      unsigned int priority)
+{
+  // FIXME!
+}
+
+
+
+/**
+ * Publish an SBlock on GNUnet.
+ *
+ * @param h handle to the file sharing subsystem
+ * @param namespace namespace to publish in
+ * @param identifier identifier to use
+ * @param update update identifier to use
+ * @param meta metadata to use
+ * @param uri URI to refer to in the SBlock
+ * @param expirationTime when the SBlock expires
+ * @param anonymity anonymity level for the SBlock
+ * @param priority priority for the SBlock
+ */
+// FIXME: cps this one
+void
+GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h,
+                      struct GNUNET_FS_Namespace *namespace,
+                      const char *identifier,
+                      const char *update,
+                      struct GNUNET_CONTAINER_MetaData *meta,
+                      struct GNUNET_FS_Uri *uri,
+                      struct GNUNET_TIME_Absolute expirationTime,
+                      unsigned int anonymity,
+                      unsigned int priority)
+{               
+  // FIXME
+}
+
 /* end of fs_publish.c */
index 6e18e67c8e85427a4334a5c01accba834443f363..2b0880f0df6af2bbe80114de1f32a01b5e09a3aa 100644 (file)
@@ -1803,6 +1803,54 @@ void
 GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *sc);
 
 
+/**
+ * Publish a KBlock on GNUnet.
+ *
+ * @param h handle to the file sharing subsystem
+ * @param keyword keyword to use
+ * @param meta metadata to use
+ * @param uri URI to refer to in the KBlock
+ * @param expirationTime when the KBlock expires
+ * @param anonymity anonymity level for the KBlock
+ * @param priority priority for the KBlock
+ */
+// FIXME: CPS this one..
+void
+GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h,
+                      const char *keyword,
+                      struct GNUNET_CONTAINER_MetaData *meta,
+                      struct GNUNET_FS_Uri *uri,
+                      struct GNUNET_TIME_Absolute expirationTime,
+                      unsigned int anonymity,
+                      unsigned int priority);
+
+
+/**
+ * Publish an SBlock on GNUnet.
+ *
+ * @param h handle to the file sharing subsystem
+ * @param namespace namespace to publish in
+ * @param identifier identifier to use
+ * @param update update identifier to use
+ * @param meta metadata to use
+ * @param uri URI to refer to in the SBlock
+ * @param expirationTime when the SBlock expires
+ * @param anonymity anonymity level for the SBlock
+ * @param priority priority for the SBlock
+ */
+// FIXME: CPS this one..
+void
+GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h,
+                      struct GNUNET_FS_Namespace *namespace,
+                      const char *identifier,
+                      const char *update,
+                      struct GNUNET_CONTAINER_MetaData *meta,
+                      struct GNUNET_FS_Uri *uri,
+                      struct GNUNET_TIME_Absolute expirationTime,
+                      unsigned int anonymity,
+                      unsigned int priority);
+
+
 /**
  * Type of a function called by "GNUNET_FS_get_indexed_files".
  *