changing datastore API to support replication level --- not fully implemented --...
authorChristian Grothoff <christian@grothoff.org>
Sun, 3 Apr 2011 13:47:56 +0000 (13:47 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sun, 3 Apr 2011 13:47:56 +0000 (13:47 +0000)
34 files changed:
contrib/defaults.conf
doc/man/gnunet-pseudonym.1
doc/man/gnunet-publish.1
src/datastore/datastore_api.c
src/datastore/perf_datastore_api.c
src/datastore/test_datastore_api.c
src/datastore/test_datastore_api_management.c
src/fs/fs.c
src/fs/fs.h
src/fs/fs_file_information.c
src/fs/fs_namespace.c
src/fs/fs_publish.c
src/fs/fs_test_lib.c
src/fs/gnunet-pseudonym.c
src/fs/gnunet-publish.c
src/fs/gnunet-service-fs.c
src/fs/gnunet-service-fs_new.c
src/fs/gnunet-service-fs_pr.c
src/fs/gnunet-service-fs_push.c
src/fs/test_fs_download.c
src/fs/test_fs_download_indexed.c
src/fs/test_fs_download_persistence.c
src/fs/test_fs_file_information.c
src/fs/test_fs_list_indexed.c
src/fs/test_fs_namespace.c
src/fs/test_fs_namespace_list_updateable.c
src/fs/test_fs_publish.c
src/fs/test_fs_publish_persistence.c
src/fs/test_fs_search.c
src/fs/test_fs_search_persistence.c
src/fs/test_fs_unindex.c
src/fs/test_fs_unindex_persistence.c
src/include/gnunet_datastore_service.h
src/include/gnunet_fs_service.h

index f0ee4e3e075dc75ebaf18fcc21143910b83c9938..fe98f1d1844267382adf29b2e090dd7aea03eb00 100644 (file)
@@ -295,7 +295,7 @@ PORT = 2094
 HOSTNAME = localhost
 HOME = $SERVICEHOME
 CONFIG = $DEFAULTCONFIG
-BINARY = gnunet-service-fs
+BINARY = gnunet-service-fs-new
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
 
index 30e7c4145390e80562e45d675ea1eb4faf376c47..5d3c41b6219959a7ce9c49ff5671aaaf83242615 100644 (file)
@@ -55,7 +55,11 @@ Set the priority of the namespace advertisement (default: 365).  If the local da
 Do not print the list of pseudonyms (only perform create or delete operation).
 
 .TP
-\fB\-r IDENTIFIER\fR, \fB\-\-root=IDENTIFIER\fR
+\fB\-r \fILEVEL\fR, \fB\-\-replication=\fILEVEL\fR
+Set the desired replication level.  If CONTENT_PUSHING is set to YES, GNUnet will push each block (for the file) LEVEL times to other peers before doing nomral "random" replication of all content.  This option can be used to push some content out into the network harder. Note that pushing content LEVEL times into the network does not guarantee that there will actually be LEVEL replicas.
+
+.TP
+\fB\-R IDENTIFIER\fR, \fB\-\-root=IDENTIFIER\fR
 Specify the identifier for the root of the namespace.  Used in the namespace advertisement to tell users that find the namespace advertisement about an entry\-point into the namespace (use with \-C).  Advertisements are only created if "\-C" and "\-r" are specified.
 
 .TP
index df20596297034b9db7964776f4548dbbbabdf80d..22bd4ae747e6d1d0c03355bb32f41f400ca97036 100644 (file)
@@ -77,6 +77,10 @@ Set the priority of the published content (default: 365).  If the local database
 \fB\-P \fINAME\fR, \fB\-\-pseudonym=\fINAME\fR
 For the top\-level directory or file, create an SBlock that places the file into the namespace specified by the pseudonym NAME.
 
+.TP
+\fB\-r \fILEVEL\fR, \fB\-\-replication=\fILEVEL\fR
+Set the desired replication level.  If CONTENT_PUSHING is set to YES, GNUnet will push each block (for the file) LEVEL times to other peers before doing nomral "random" replication of all content.  This option can be used to push some content out into the network harder. Note that pushing content LEVEL times into the network does not guarantee that there will actually be LEVEL replicas.
+
 .TP
 \fB\-s\fR, \fB\-\-simulate-only\fR
 When this option is used, gnunet\-publish will not actually publish the file but just simulate what would be done.  This can be used to compute the GNUnet URI for a file without actually sharing it.
index cf6a2cc8e0a44bf9ced5eed25f2c8dd2d4bd64ff..344a7084205d78bf63d149c34f018ec636848673 100644 (file)
@@ -792,6 +792,7 @@ process_status_message (void *cls,
  * @param type type of the content
  * @param priority priority of the content
  * @param anonymity anonymity-level for the content
+ * @param replication how often should the content be replicated to other peers?
  * @param expiration expiration time for the content
  * @param queue_priority ranking of this request in the priority queue
  * @param max_queue_size at what queue size should this request be dropped
@@ -812,6 +813,7 @@ GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h,
                       enum GNUNET_BLOCK_Type type,
                       uint32_t priority,
                       uint32_t anonymity,
+                     uint32_t replication,
                       struct GNUNET_TIME_Absolute expiration,
                      unsigned int queue_priority,
                      unsigned int max_queue_size,
@@ -1274,7 +1276,11 @@ process_result_message (void *cls,
 
 
 /**
- * Get a random value from the datastore.
+ * Get a random value from the datastore for content replication.
+ * Returns a single, random value among those with the highest
+ * replication score, lowering positive replication scores by one for
+ * the chosen value (if only content with a replication score exists,
+ * a random value is returned and replication scores are not changed).
  *
  * @param h handle to the datastore
  * @param queue_priority ranking of this request in the priority queue
@@ -1290,12 +1296,12 @@ process_result_message (void *cls,
  *         (or rather, will already have been invoked)
  */
 struct GNUNET_DATASTORE_QueueEntry *
-GNUNET_DATASTORE_get_random (struct GNUNET_DATASTORE_Handle *h,
-                            unsigned int queue_priority,
-                            unsigned int max_queue_size,
-                            struct GNUNET_TIME_Relative timeout,
-                             GNUNET_DATASTORE_Iterator iter, 
-                            void *iter_cls)
+GNUNET_DATASTORE_get_for_replication (struct GNUNET_DATASTORE_Handle *h,
+                                     unsigned int queue_priority,
+                                     unsigned int max_queue_size,
+                                     struct GNUNET_TIME_Relative timeout,
+                                     GNUNET_DATASTORE_Iterator iter, 
+                                     void *iter_cls)
 {
   struct GNUNET_DATASTORE_QueueEntry *qe;
   struct GNUNET_MessageHeader *m;
index de9a8b23633048741967b94d8bee2000ae8249d0..00d91b4c788c71387ae9232318bd55b485e18357 100644 (file)
@@ -269,7 +269,7 @@ run_continuation (void *cls,
                            data,
                            i+1,
                            GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100),
-                           i,
+                           i, 0,
                            GNUNET_TIME_relative_to_absolute 
                            (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
                                                            GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1000))),
@@ -279,10 +279,10 @@ run_continuation (void *cls,
       break;
     case RP_CUT:
       /* trim down below MAX_SIZE again */
-      GNUNET_DATASTORE_get_random (datastore, 
-                                  1, 1, TIMEOUT,
-                                  &delete_value,
-                                  crc);
+      GNUNET_DATASTORE_get_for_replication (datastore, 
+                                           1, 1, TIMEOUT,
+                                           &delete_value,
+                                           crc);
       break;
     case RP_REPORT:
       printf (
@@ -355,7 +355,7 @@ run (void *cls,
       GNUNET_DATASTORE_put (datastore, 0,
                            &zkey, 4, "TEST",
                            GNUNET_BLOCK_TYPE_TEST,
-                           0, 0, GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS),
+                           0, 0, 0, GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS),
                            0, 1, GNUNET_TIME_UNIT_MINUTES,
                            &run_tests, crc))
     {
index d8e4b7b342eec4183616e0e1274d192974408977..965f05687908353ec7ad6326b342ab15d7a038da 100644 (file)
@@ -402,6 +402,7 @@ run_continuation (void *cls,
                            get_type (crc->i),
                            get_priority (crc->i),
                            get_anonymity (crc->i),
+                           0,
                            get_expiration (crc->i),
                            1, 1, TIMEOUT,
                            &check_success,
@@ -502,6 +503,7 @@ run_continuation (void *cls,
                            get_type (42),
                            get_priority (42),
                            get_anonymity (42),
+                           0,
                            get_expiration (42),
                            1, 1, TIMEOUT,
                            &check_success,
@@ -517,6 +519,7 @@ run_continuation (void *cls,
                            get_type (42),
                            get_priority (43),
                            get_anonymity (43),
+                           0,
                            get_expiration (43),
                            1, 1, TIMEOUT,
                            &check_success,
@@ -613,7 +616,7 @@ run (void *cls,
       GNUNET_DATASTORE_put (datastore, 0,
                            &zkey, 4, "TEST",
                            GNUNET_BLOCK_TYPE_TEST,
-                           0, 0, GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS),
+                           0, 0, 0, GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS),
                            0, 1, GNUNET_TIME_UNIT_MINUTES,
                            &run_tests, crc))
     {
index 2873caa02190621710e58bebdbba7f56db65a29b..50a426af6e108c01e53daf3c7a2dec9e5cfd137a 100644 (file)
@@ -231,6 +231,7 @@ run_continuation (void *cls,
                            get_type (crc->i),
                            get_priority (crc->i),
                            get_anonymity (crc->i),
+                           0,
                            get_expiration (crc->i),
                            1, 1, TIMEOUT,
                            &check_success,
@@ -327,7 +328,7 @@ run (void *cls,
       GNUNET_DATASTORE_put (datastore, 0,
                            &zkey, 4, "TEST",
                            GNUNET_BLOCK_TYPE_TEST,
-                           0, 0, GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS),
+                           0, 0, 0, GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS),
                            0, 1, GNUNET_TIME_UNIT_MINUTES,
                            &run_tests, crc))
     {
index 36eb3e5e1f601eb032dece2e1297935686bce639..81250b88c4403c6f0d4d7f5cabedb3e679fc3a14 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 Christian Grothoff (and other contributing authors)
+     (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -768,8 +768,6 @@ deserialize_fi_node (struct GNUNET_FS_Handle *h,
            (ret->chk_uri = GNUNET_FS_uri_parse (chks, NULL))) ||
           (GNUNET_YES !=
            GNUNET_FS_uri_test_chk (ret->chk_uri)) ) ) ||
-       (GNUNET_OK !=
-       GNUNET_BIO_read_int64 (rh, &ret->expirationTime.abs_value)) ||
        (GNUNET_OK !=
        read_start_time (rh, &ret->start_time)) ||
        (GNUNET_OK !=
@@ -777,9 +775,13 @@ deserialize_fi_node (struct GNUNET_FS_Handle *h,
        (GNUNET_OK !=
        GNUNET_BIO_read_string (rh, "fn", &ret->filename, 16*1024)) ||
        (GNUNET_OK !=
-       GNUNET_BIO_read_int32 (rh, &ret->anonymity)) ||
+       GNUNET_BIO_read_int64 (rh, &ret->bo.expiration_time.abs_value)) ||
+       (GNUNET_OK !=
+       GNUNET_BIO_read_int32 (rh, &ret->bo.anonymity_level)) ||
+       (GNUNET_OK !=
+       GNUNET_BIO_read_int32 (rh, &ret->bo.content_priority)) ||
        (GNUNET_OK !=
-       GNUNET_BIO_read_int32 (rh, &ret->priority)) )
+       GNUNET_BIO_read_int32 (rh, &ret->bo.replication_level)) )
     {
       GNUNET_break (0);      
       goto cleanup;
@@ -1180,8 +1182,6 @@ GNUNET_FS_file_information_sync_ (struct GNUNET_FS_FileInformation * fi)
        GNUNET_BIO_write_string (wh, ksks)) ||
        (GNUNET_OK !=
        GNUNET_BIO_write_string (wh, chks)) ||
-       (GNUNET_OK != 
-       GNUNET_BIO_write_int64 (wh, fi->expirationTime.abs_value)) ||
        (GNUNET_OK != 
        write_start_time (wh, fi->start_time)) ||
        (GNUNET_OK !=
@@ -1189,9 +1189,13 @@ GNUNET_FS_file_information_sync_ (struct GNUNET_FS_FileInformation * fi)
        (GNUNET_OK !=
        GNUNET_BIO_write_string (wh, fi->filename)) ||
        (GNUNET_OK != 
-       GNUNET_BIO_write_int32 (wh, fi->anonymity)) ||
+       GNUNET_BIO_write_int64 (wh, fi->bo.expiration_time.abs_value)) ||
+       (GNUNET_OK != 
+       GNUNET_BIO_write_int32 (wh, fi->bo.anonymity_level)) ||
+       (GNUNET_OK != 
+       GNUNET_BIO_write_int32 (wh, fi->bo.content_priority)) ||
        (GNUNET_OK != 
-       GNUNET_BIO_write_int32 (wh, fi->priority)) )
+       GNUNET_BIO_write_int32 (wh, fi->bo.replication_level)) )
     {
       GNUNET_break (0);
       goto cleanup;
@@ -1340,10 +1344,8 @@ find_file_position (struct GNUNET_FS_FileInformation *pos,
  * @param length length of the file or directory
  * @param meta metadata for the file or directory (can be modified)
  * @param uri pointer to the keywords that will be used for this entry (can be modified)
- * @param anonymity pointer to selected anonymity level (can be modified)
- * @param priority pointer to selected priority (can be modified)
+ * @param bo block options (can be modified)
  * @param do_index should we index?
- * @param expirationTime pointer to selected expiration time (can be modified)
  * @param client_info pointer to client context set upon creation (can be modified)
  * @return GNUNET_OK to continue (always)
  */
@@ -1353,10 +1355,8 @@ fip_signal_resume(void *cls,
                  uint64_t length,
                  struct GNUNET_CONTAINER_MetaData *meta,
                  struct GNUNET_FS_Uri **uri,
-                 uint32_t *anonymity,
-                 uint32_t *priority,
+                 struct GNUNET_FS_BlockOptions *bo,
                  int *do_index,
-                 struct GNUNET_TIME_Absolute *expirationTime,
                  void **client_info)
 {
   struct GNUNET_FS_PublishContext *sc = cls;
index ff769cfca61c8b0254a7bbdbd26571121153bd0f..2040d035aeb5ada39c1a6cfdb5edaf1f4741dcba 100644 (file)
@@ -438,9 +438,9 @@ struct GNUNET_FS_FileInformation
   struct GNUNET_FS_Uri *chk_uri;
 
   /**
-   * At what time should the content expire?
+   * Block options for the file.
    */
-  struct GNUNET_TIME_Absolute expirationTime;
+  struct GNUNET_FS_BlockOptions bo;
 
   /**
    * At what time did we start this upload?
@@ -547,16 +547,6 @@ struct GNUNET_FS_FileInformation
 
   } data;
 
-  /**
-   * Desired anonymity level.
-   */
-  uint32_t anonymity;
-
-  /**
-   * Desired priority (for keeping the content in the DB).
-   */
-  uint32_t priority;
-
   /**
    * Is this struct for a file or directory?
    */
index 2ae708e59521900c53527e713d307dbf697835a3..b248fae44353d1440316ed52fba20714fa68fb31 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2009 Christian Grothoff (and other contributing authors)
+     (C) 2009, 2011 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -132,11 +132,7 @@ GNUNET_FS_file_information_get_id (struct GNUNET_FS_FileInformation *s)
  * @param meta metadata for the file
  * @param do_index GNUNET_YES for index, GNUNET_NO for insertion,
  *                GNUNET_SYSERR for simulation
- * @param anonymity what is the desired anonymity level for sharing?
- * @param priority what is the priority for OUR node to
- *   keep this file available?  Use 0 for maximum anonymity and
- *   minimum reliability...
- * @param expirationTime when should this content expire?
+ * @param bo block options
  * @return publish structure entry for the file
  */
 struct GNUNET_FS_FileInformation *
@@ -146,9 +142,7 @@ GNUNET_FS_file_information_create_from_file (struct GNUNET_FS_Handle *h,
                                             const struct GNUNET_FS_Uri *keywords,
                                             const struct GNUNET_CONTAINER_MetaData *meta,
                                             int do_index,
-                                            uint32_t anonymity,
-                                            uint32_t priority,
-                                            struct GNUNET_TIME_Absolute expirationTime)
+                                            const struct GNUNET_FS_BlockOptions *bo)
 {
   struct FileInfo *fi;
   struct stat sbuf;
@@ -177,9 +171,7 @@ GNUNET_FS_file_information_create_from_file (struct GNUNET_FS_Handle *h,
                                                       keywords,
                                                       meta,
                                                       do_index,
-                                                      anonymity,
-                                                      priority,
-                                                      expirationTime);
+                                                      bo);
   if (ret == NULL)
     return NULL;
   ret->h = h;
@@ -212,11 +204,7 @@ GNUNET_FS_file_information_create_from_file (struct GNUNET_FS_Handle *h,
  * @param meta metadata for the file
  * @param do_index GNUNET_YES for index, GNUNET_NO for insertion,
  *                GNUNET_SYSERR for simulation
- * @param anonymity what is the desired anonymity level for sharing?
- * @param priority what is the priority for OUR node to
- *   keep this file available?  Use 0 for maximum anonymity and
- *   minimum reliability...
- * @param expirationTime when should this content expire?
+ * @param bo block options
  * @return publish structure entry for the file
  */
 struct GNUNET_FS_FileInformation *
@@ -227,9 +215,7 @@ GNUNET_FS_file_information_create_from_data (struct GNUNET_FS_Handle *h,
                                             const struct GNUNET_FS_Uri *keywords,
                                             const struct GNUNET_CONTAINER_MetaData *meta,
                                             int do_index,
-                                            uint32_t anonymity,
-                                            uint32_t priority,
-                                            struct GNUNET_TIME_Absolute expirationTime)
+                                            const struct GNUNET_FS_BlockOptions *bo)
 {
   if (GNUNET_YES == do_index)        
     {
@@ -244,9 +230,7 @@ GNUNET_FS_file_information_create_from_data (struct GNUNET_FS_Handle *h,
                                                        keywords,
                                                        meta,
                                                        do_index,
-                                                       anonymity,
-                                                       priority,
-                                                       expirationTime);
+                                                       bo);
 }
 
 
@@ -263,11 +247,7 @@ GNUNET_FS_file_information_create_from_data (struct GNUNET_FS_Handle *h,
  * @param meta metadata for the file
  * @param do_index GNUNET_YES for index, GNUNET_NO for insertion,
  *                GNUNET_SYSERR for simulation
- * @param anonymity what is the desired anonymity level for sharing?
- * @param priority what is the priority for OUR node to
- *   keep this file available?  Use 0 for maximum anonymity and
- *   minimum reliability...
- * @param expirationTime when should this content expire?
+ * @param bo block options
  * @return publish structure entry for the file
  */
 struct GNUNET_FS_FileInformation *
@@ -279,9 +259,7 @@ GNUNET_FS_file_information_create_from_reader (struct GNUNET_FS_Handle *h,
                                               const struct GNUNET_FS_Uri *keywords,
                                               const struct GNUNET_CONTAINER_MetaData *meta,
                                               int do_index,
-                                              uint32_t anonymity,
-                                              uint32_t priority,
-                                              struct GNUNET_TIME_Absolute expirationTime)
+                                              const struct GNUNET_FS_BlockOptions *bo)
 {
   struct GNUNET_FS_FileInformation *ret;
 
@@ -298,13 +276,11 @@ GNUNET_FS_file_information_create_from_reader (struct GNUNET_FS_Handle *h,
   if (ret->meta == NULL)
     ret->meta = GNUNET_CONTAINER_meta_data_create ();
   ret->keywords = (keywords == NULL) ? NULL : GNUNET_FS_uri_dup (keywords);
-  ret->expirationTime = expirationTime;
   ret->data.file.reader = reader; 
   ret->data.file.reader_cls = reader_cls;
   ret->data.file.do_index = do_index;
   ret->data.file.file_size = length;
-  ret->anonymity = anonymity;
-  ret->priority = priority;
+  ret->bo = *bo;
   return ret;
 }
 
@@ -350,24 +326,15 @@ struct DirScanCls
   char *emsg; 
 
   /**
-   * Should files be indexed?
-   */ 
-  int do_index;
-
-  /**
-   * Desired anonymity level.
+   * Block options.
    */
-  uint32_t anonymity;
+  const struct GNUNET_FS_BlockOptions *bo;
 
   /**
-   * Desired publishing priority.
-   */
-  uint32_t priority;
+   * Should files be indexed?
+   */ 
+  int do_index;
 
-  /**
-   * Expiration time for publication.
-   */
-  struct GNUNET_TIME_Absolute expiration;
 };
 
 
@@ -406,9 +373,7 @@ dir_scan_cb (void *cls,
                                                             dsc->scanner,
                                                             dsc->scanner_cls,
                                                             dsc->do_index,
-                                                            dsc->anonymity,
-                                                            dsc->priority,
-                                                            dsc->expiration,
+                                                            dsc->bo,
                                                             &dsc->emsg);
       if (NULL == fi)
        {
@@ -430,9 +395,7 @@ dir_scan_cb (void *cls,
                                                        ksk_uri,
                                                        meta,
                                                        dsc->do_index,
-                                                       dsc->anonymity,
-                                                       dsc->priority,
-                                                       dsc->expiration);
+                                                       dsc->bo);
       GNUNET_CONTAINER_meta_data_destroy (meta);
       GNUNET_FS_uri_destroy (keywords);
       GNUNET_FS_uri_destroy (ksk_uri);
@@ -459,9 +422,7 @@ dir_scan_cb (void *cls,
  * @param h handle to the file sharing subsystem
  * @param dirname name of the directory to scan
  * @param do_index should files be indexed or inserted
- * @param anonymity desired anonymity level
- * @param priority priority for publishing
- * @param expirationTime expiration for publication
+ * @param bo block options
  * @param proc function called on each entry
  * @param proc_cls closure for proc
  * @param emsg where to store an error message (on errors)
@@ -472,9 +433,7 @@ GNUNET_FS_directory_scanner_default (void *cls,
                                     struct GNUNET_FS_Handle *h,
                                     const char *dirname,
                                     int do_index,
-                                    uint32_t anonymity,
-                                    uint32_t priority,
-                                    struct GNUNET_TIME_Absolute expirationTime,
+                                    const struct GNUNET_FS_BlockOptions *bo,
                                     GNUNET_FS_FileProcessor proc,
                                     void *proc_cls,
                                     char **emsg)
@@ -489,9 +448,7 @@ GNUNET_FS_directory_scanner_default (void *cls,
   dsc.scanner = &GNUNET_FS_directory_scanner_default;
   dsc.scanner_cls = cls;
   dsc.do_index = do_index;
-  dsc.anonymity = anonymity;
-  dsc.priority = priority;
-  dsc.expiration = expirationTime;
+  dsc.bo = bo;
   if (-1 == GNUNET_DISK_directory_scan (dirname,
                                        &dir_scan_cb,
                                        &dsc))
@@ -555,11 +512,7 @@ dirproc (void *cls,
  * @param scanner function used to get a list of files in a directory
  * @param scanner_cls closure for scanner
  * @param do_index should files in the hierarchy be indexed?
- * @param anonymity what is the desired anonymity level for sharing?
- * @param priority what is the priority for OUR node to
- *   keep this file available?  Use 0 for maximum anonymity and
- *   minimum reliability...
- * @param expirationTime when should this content expire?
+ * @param bo block options
  * @param emsg where to store an error message
  * @return publish structure entry for the directory, NULL on error
  */
@@ -570,9 +523,7 @@ GNUNET_FS_file_information_create_from_directory (struct GNUNET_FS_Handle *h,
                                                  GNUNET_FS_DirectoryScanner scanner,
                                                  void *scanner_cls,
                                                  int do_index,
-                                                 uint32_t anonymity,
-                                                 uint32_t priority,
-                                                 struct GNUNET_TIME_Absolute expirationTime,
+                                                 const struct GNUNET_FS_BlockOptions *bo,
                                                  char **emsg)
 {
   struct GNUNET_FS_FileInformation *ret;
@@ -590,9 +541,7 @@ GNUNET_FS_file_information_create_from_directory (struct GNUNET_FS_Handle *h,
           h,
           filename,
           do_index,
-          anonymity,
-          priority,
-          expirationTime,
+          bo,
           &dirproc,
           &dc,
           emsg);
@@ -602,9 +551,7 @@ GNUNET_FS_file_information_create_from_directory (struct GNUNET_FS_Handle *h,
                                                           client_info,
                                                           ksk,
                                                           meta,
-                                                          anonymity,
-                                                          priority,
-                                                          expirationTime);
+                                                          bo);
   GNUNET_CONTAINER_meta_data_destroy (meta);
   ret->data.dir.entries = dc.entries;
   while (dc.entries != NULL)
@@ -657,11 +604,7 @@ GNUNET_FS_file_information_is_directory (struct GNUNET_FS_FileInformation *ent)
  * @param meta metadata for the directory
  * @param keywords under which keywords should this directory be available
  *         directly; can be NULL
- * @param anonymity what is the desired anonymity level for sharing?
- * @param priority what is the priority for OUR node to
- *   keep this file available?  Use 0 for maximum anonymity and
- *   minimum reliability...
- * @param expirationTime when should this content expire?
+ * @param bo block options
  * @return publish structure entry for the directory , NULL on error
  */
 struct GNUNET_FS_FileInformation *
@@ -669,9 +612,7 @@ GNUNET_FS_file_information_create_empty_directory (struct GNUNET_FS_Handle *h,
                                                   void *client_info,
                                                   const struct GNUNET_FS_Uri *keywords,
                                                   const struct GNUNET_CONTAINER_MetaData *meta,
-                                                  uint32_t anonymity,
-                                                  uint32_t priority,
-                                                  struct GNUNET_TIME_Absolute expirationTime)
+                                                  const struct GNUNET_FS_BlockOptions *bo)
 {
   struct GNUNET_FS_FileInformation *ret;
 
@@ -680,10 +621,8 @@ GNUNET_FS_file_information_create_empty_directory (struct GNUNET_FS_Handle *h,
   ret->client_info = client_info;
   ret->meta = GNUNET_CONTAINER_meta_data_duplicate (meta);
   ret->keywords = GNUNET_FS_uri_dup (keywords);
-  ret->expirationTime = expirationTime;
+  ret->bo = *bo;
   ret->is_directory = GNUNET_YES;
-  ret->anonymity = anonymity;
-  ret->priority = priority;
   return ret;
 }
 
@@ -747,10 +686,8 @@ GNUNET_FS_file_information_inspect (struct GNUNET_FS_FileInformation *dir,
            (dir->is_directory) ? dir->data.dir.dir_size : dir->data.file.file_size,
            dir->meta,
            &dir->keywords,
-           &dir->anonymity,
-           &dir->priority,
+           &dir->bo,
            (dir->is_directory) ? &no : &dir->data.file.do_index,
-           &dir->expirationTime,
            &dir->client_info))
     return;
   if (! dir->is_directory)
@@ -765,10 +702,8 @@ GNUNET_FS_file_information_inspect (struct GNUNET_FS_FileInformation *dir,
                (pos->is_directory) ? pos->data.dir.dir_size : pos->data.file.file_size,
                pos->meta,
                &pos->keywords,
-               &pos->anonymity,
-               &pos->priority,
+               &pos->bo,
                (dir->is_directory) ? &no : &dir->data.file.do_index,
-               &pos->expirationTime,
                &pos->client_info))
        break;
       pos = pos->next;
@@ -810,10 +745,8 @@ GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi,
                 fi->data.dir.dir_size,
                 fi->meta,
                 &fi->keywords,
-                &fi->anonymity,
-                &fi->priority,
+                &fi->bo,
                 &no,
-                &fi->expirationTime,
                 &fi->client_info);
       GNUNET_free_non_null (fi->data.dir.dir_data);
     }
@@ -830,10 +763,8 @@ GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi,
                 fi->data.file.file_size,
                 fi->meta,
                 &fi->keywords,
-                &fi->anonymity,
-                &fi->priority,
+                &fi->bo,
                 &fi->data.file.do_index,
-                &fi->expirationTime,
                 &fi->client_info);
     }
   GNUNET_free_non_null (fi->filename);
index bc66bb21fa800564c7ecd2da622099e3ef57dd82..175879707fd2da0a3d9d69eacc7750c2312859d1 100644 (file)
@@ -285,25 +285,15 @@ struct AdvertisementContext
   struct GNUNET_FS_Namespace *ns;
 
   /**
-   * Expiration time.
+   * Block options.
    */
-  struct GNUNET_TIME_Absolute expiration;
+  struct GNUNET_FS_BlockOptions bo;
 
   /**
    * Number of bytes of plaintext.
    */ 
   size_t pt_size;
 
-  /**
-   * Anonymity level.
-   */
-  uint32_t anonymity;
-
-  /**
-   * Content priority.
-   */
-  uint32_t priority;
-
   /**
    * Current keyword offset.
    */
@@ -410,9 +400,10 @@ advertisement_cont (void *cls,
                        ac->pt_size + sizeof (struct NBlock),
                        ac->nb,
                        GNUNET_BLOCK_TYPE_FS_NBLOCK,
-                       ac->priority,
-                       ac->anonymity,
-                       ac->expiration,
+                       ac->bo.content_priority,
+                       ac->bo.anonymity_level,
+                       ac->bo.replication_level,
+                       ac->bo.expiration_time,
                        -2, 1,
                        GNUNET_CONSTANTS_SERVICE_TIMEOUT, 
                        &advertisement_cont,
@@ -427,9 +418,7 @@ advertisement_cont (void *cls,
  * @param ksk_uri keywords to use for advertisment
  * @param namespace handle for the namespace that should be advertised
  * @param meta meta-data for the namespace advertisement
- * @param anonymity for the namespace advertismement
- * @param priority for the namespace advertisement
- * @param expiration for the namespace advertisement
+ * @param bo block options
  * @param rootEntry name of the root of the namespace
  * @param cont continuation
  * @param cont_cls closure for cont
@@ -439,9 +428,7 @@ GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h,
                               struct GNUNET_FS_Uri *ksk_uri,
                               struct GNUNET_FS_Namespace *namespace,
                               const struct GNUNET_CONTAINER_MetaData *meta,
-                              uint32_t anonymity,
-                              uint32_t priority,
-                              struct GNUNET_TIME_Absolute expiration,
+                              const struct GNUNET_FS_BlockOptions *bo,
                               const char *rootEntry,
                               GNUNET_FS_PublishContinuation cont,
                               void *cont_cls)
@@ -512,9 +499,7 @@ GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h,
   ctx->pt_size = mdsize + reslen;
   ctx->ns = namespace;
   ctx->ns->rc++;
-  ctx->anonymity = anonymity;
-  ctx->priority = priority;
-  ctx->expiration = expiration;
+  ctx->bo = *bo;
   advertisement_cont (ctx, GNUNET_OK, NULL);
 }
 
@@ -828,9 +813,7 @@ sb_put_cont (void *cls,
  * @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
+ * @param bo block options
  * @param options publication options
  * @param cont continuation
  * @param cont_cls closure for cont
@@ -842,9 +825,7 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h,
                       const char *update,
                       const struct GNUNET_CONTAINER_MetaData *meta,
                       const struct GNUNET_FS_Uri *uri,
-                      struct GNUNET_TIME_Absolute expirationTime,
-                      uint32_t anonymity,
-                      uint32_t priority,
+                      const struct GNUNET_FS_BlockOptions *bo,
                       enum GNUNET_FS_PublishOptions options,
                       GNUNET_FS_PublishContinuation cont,
                       void *cont_cls)
@@ -975,9 +956,10 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h,
                        size,
                        sb_enc,
                        GNUNET_BLOCK_TYPE_FS_SBLOCK, 
-                       priority,
-                       anonymity,
-                       expirationTime,
+                       bo->content_priority,
+                       bo->anonymity_level,
+                       bo->replication_level,
+                       bo->expiration_time,
                        -2, 1,
                        GNUNET_CONSTANTS_SERVICE_TIMEOUT,
                        &sb_put_cont,
index ac69c94a1039caff60227908d37fb9ca13287664..36efb27f67b1ab1f5363e818ad782f06669a015f 100644 (file)
@@ -95,7 +95,7 @@ GNUNET_FS_publish_make_status_ (struct GNUNET_FS_ProgressInfo *pi,
                                 pi->value.publish.size);
   pi->value.publish.completed = offset;
   pi->value.publish.duration = GNUNET_TIME_absolute_get_duration (p->start_time);
-  pi->value.publish.anonymity = p->anonymity;
+  pi->value.publish.anonymity = p->bo.anonymity_level;
   return sc->h->upcb (sc->h->upcb_cls,
                      pi);
 }
@@ -324,9 +324,7 @@ publish_sblock (struct GNUNET_FS_PublishContext *sc)
                           sc->nuid,
                           sc->fi->meta,
                           sc->fi->chk_uri,
-                          sc->fi->expirationTime,
-                          sc->fi->anonymity,
-                          sc->fi->priority,
+                          &sc->fi->bo,
                           sc->options,
                           &publish_sblocks_cont,
                           sc);
@@ -569,9 +567,10 @@ block_proc (void *cls,
                            sizeof (struct OnDemandBlock),
                            &odb,
                            GNUNET_BLOCK_TYPE_FS_ONDEMAND,
-                           p->priority,
-                           p->anonymity,
-                           p->expirationTime,
+                           p->bo.content_priority,
+                           p->bo.anonymity_level,
+                           p->bo.replication_level,
+                           p->bo.expiration_time,
                            -2, 1,
                            GNUNET_CONSTANTS_SERVICE_TIMEOUT,
                            &ds_put_cont,
@@ -591,9 +590,10 @@ block_proc (void *cls,
                        block_size,
                        block,
                        type,
-                       p->priority,
-                       p->anonymity,
-                       p->expirationTime,
+                       p->bo.content_priority,
+                       p->bo.anonymity_level,
+                       p->bo.replication_level,
+                       p->bo.expiration_time,
                        -2, 1,
                        GNUNET_CONSTANTS_SERVICE_TIMEOUT,
                        &ds_put_cont,
@@ -990,12 +990,12 @@ GNUNET_FS_publish_main_ (void *cls,
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                  "File upload complete, now publishing KSK blocks.\n");
 #endif
-      if (0 == p->anonymity)
+      if (0 == p->bo.anonymity_level)
        {
          /* zero anonymity, box CHK URI in LOC URI */
          loc = GNUNET_FS_uri_loc_create (p->chk_uri,
                                          pc->h->cfg,
-                                         p->expirationTime);
+                                         p->bo.expiration_time);
          GNUNET_FS_uri_destroy (p->chk_uri);
          p->chk_uri = loc;
        }
@@ -1007,9 +1007,7 @@ GNUNET_FS_publish_main_ (void *cls,
                                 p->keywords,
                                 p->meta,
                                 p->chk_uri,
-                                p->expirationTime,
-                                p->anonymity,
-                                p->priority,
+                                &p->bo,
                                 pc->options,
                                 &publish_kblocks_cont,
                                 pc);
@@ -1065,10 +1063,8 @@ GNUNET_FS_publish_main_ (void *cls,
  * @param length length of the file or directory
  * @param meta metadata for the file or directory (can be modified)
  * @param uri pointer to the keywords that will be used for this entry (can be modified)
- * @param anonymity pointer to selected anonymity level (can be modified)
- * @param priority pointer to selected priority (can be modified)
+ * @param bo block options
  * @param do_index should we index?
- * @param expirationTime pointer to selected expiration time (can be modified)
  * @param client_info pointer to client context set upon creation (can be modified)
  * @return GNUNET_OK to continue (always)
  */
@@ -1078,10 +1074,8 @@ fip_signal_start(void *cls,
                 uint64_t length,
                 struct GNUNET_CONTAINER_MetaData *meta,
                 struct GNUNET_FS_Uri **uri,
-                uint32_t *anonymity,
-                uint32_t *priority,
+                struct GNUNET_FS_BlockOptions *bo,
                 int *do_index,
-                struct GNUNET_TIME_Absolute *expirationTime,
                 void **client_info)
 {
   struct GNUNET_FS_PublishContext *sc = cls;
@@ -1134,10 +1128,8 @@ fip_signal_start(void *cls,
  * @param length length of the file or directory
  * @param meta metadata for the file or directory (can be modified)
  * @param uri pointer to the keywords that will be used for this entry (can be modified)
- * @param anonymity pointer to selected anonymity level (can be modified)
- * @param priority pointer to selected priority (can be modified)
+ * @param bo block options
  * @param do_index should we index?
- * @param expirationTime pointer to selected expiration time (can be modified)
  * @param client_info pointer to client context set upon creation (can be modified)
  * @return GNUNET_OK to continue (always)
  */
@@ -1147,10 +1139,8 @@ fip_signal_suspend(void *cls,
                   uint64_t length,
                   struct GNUNET_CONTAINER_MetaData *meta,
                   struct GNUNET_FS_Uri **uri,
-                  uint32_t *anonymity,
-                  uint32_t *priority,
+                  struct GNUNET_FS_BlockOptions *bo,
                   int *do_index,
-                  struct GNUNET_TIME_Absolute *expirationTime,
                   void **client_info)
 {
   struct GNUNET_FS_PublishContext*sc = cls;
@@ -1322,10 +1312,8 @@ GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h,
  * @param length length of the file or directory
  * @param meta metadata for the file or directory (can be modified)
  * @param uri pointer to the keywords that will be used for this entry (can be modified)
- * @param anonymity pointer to selected anonymity level (can be modified)
- * @param priority pointer to selected priority (can be modified)
+ * @param bo block options (can be modified)
  * @param do_index should we index?
- * @param expirationTime pointer to selected expiration time (can be modified)
  * @param client_info pointer to client context set upon creation (can be modified)
  * @return GNUNET_OK to continue (always)
  */
@@ -1335,10 +1323,8 @@ fip_signal_stop(void *cls,
                uint64_t length,
                struct GNUNET_CONTAINER_MetaData *meta,
                struct GNUNET_FS_Uri **uri,
-               uint32_t *anonymity,
-               uint32_t *priority,
+               struct GNUNET_FS_BlockOptions *bo,
                int *do_index,
-               struct GNUNET_TIME_Absolute *expirationTime,
                void **client_info)
 {
   struct GNUNET_FS_PublishContext*sc = cls;
@@ -1454,7 +1440,7 @@ struct PublishKskContext
   /**
    * When should the KBlocks expire?
    */
-  struct GNUNET_TIME_Absolute expirationTime;
+  struct GNUNET_FS_BlockOptions bo;
 
   /**
    * Size of the serialized metadata.
@@ -1471,15 +1457,6 @@ struct PublishKskContext
    */
   unsigned int i;
 
-  /**
-   * Anonymity level for the KBlocks.
-   */
-  uint32_t anonymity;
-
-  /**
-   * Priority for the KBlocks.
-   */
-  uint32_t priority;
 };
 
 
@@ -1604,9 +1581,10 @@ publish_ksk_cont (void *cls,
                        pkc->slen,
                        pkc->cpy,
                        GNUNET_BLOCK_TYPE_FS_KBLOCK, 
-                       pkc->priority,
-                       pkc->anonymity,
-                       pkc->expirationTime,
+                       pkc->bo.content_priority,
+                       pkc->bo.anonymity_level,
+                       pkc->bo.replication_level,
+                       pkc->bo.expiration_time,
                        -2, 1,
                        GNUNET_CONSTANTS_SERVICE_TIMEOUT,
                        &kb_put_cont,
@@ -1621,9 +1599,7 @@ publish_ksk_cont (void *cls,
  * @param ksk_uri keywords 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
+ * @param bo per-block options
  * @param options publication options
  * @param cont continuation
  * @param cont_cls closure for cont
@@ -1633,9 +1609,7 @@ GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h,
                       const struct GNUNET_FS_Uri *ksk_uri,
                       const struct GNUNET_CONTAINER_MetaData *meta,
                       const struct GNUNET_FS_Uri *uri,
-                      struct GNUNET_TIME_Absolute expirationTime,
-                      uint32_t anonymity,
-                      uint32_t priority,
+                      const struct GNUNET_FS_BlockOptions *bo,
                       enum GNUNET_FS_PublishOptions options,
                       GNUNET_FS_PublishContinuation cont,
                       void *cont_cls)
@@ -1649,9 +1623,7 @@ GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h,
   GNUNET_assert (NULL != uri);
   pkc = GNUNET_malloc (sizeof (struct PublishKskContext));
   pkc->h = h;
-  pkc->expirationTime = expirationTime;
-  pkc->anonymity = anonymity;
-  pkc->priority = priority;
+  pkc->bo = *bo;
   pkc->cont = cont;
   pkc->cont_cls = cont_cls;
   if (0 == (options & GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY))
index 4af4dae332411059b9d86e0ff1bf439e2198863e..c379d91ad3d88d6da5dfd4cc78469a4cb75dfdcf 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2010 Christian Grothoff (and other contributing authors)
+     (C) 2010, 2011 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -637,12 +637,17 @@ GNUNET_FS_TEST_publish (struct GNUNET_FS_TestDaemon *daemon,
   uint64_t off;
   char buf[DBLOCK_SIZE];
   size_t bsize;
-
+  struct GNUNET_FS_BlockOptions bo;
   GNUNET_assert (daemon->publish_cont == NULL);
   daemon->publish_cont = cont;
   daemon->publish_cont_cls = cont_cls;
   daemon->publish_seed = seed;
   daemon->verbose = verbose;
+  bo.expiration_time = GNUNET_TIME_relative_to_absolute (CONTENT_LIFETIME);
+  bo.anonymity_level = anonymity;
+  bo.content_priority = 42;
+  bo.replication_level = 1;
   if (GNUNET_YES == do_index)
     {
       GNUNET_assert (daemon->publish_tmp_file == NULL);
@@ -678,9 +683,7 @@ GNUNET_FS_TEST_publish (struct GNUNET_FS_TestDaemon *daemon,
                                                        daemon->publish_tmp_file,
                                                        NULL, NULL,
                                                        do_index,
-                                                       anonymity,
-                                                       42 /* priority */,
-                                                       GNUNET_TIME_relative_to_absolute (CONTENT_LIFETIME));
+                                                       &bo);
     }
   else
     {
@@ -692,9 +695,7 @@ GNUNET_FS_TEST_publish (struct GNUNET_FS_TestDaemon *daemon,
                                                          NULL,
                                                          NULL,
                                                          do_index,
-                                                         anonymity,
-                                                         42 /* priority */,
-                                                         GNUNET_TIME_relative_to_absolute (CONTENT_LIFETIME));
+                                                         &bo);
     }
   daemon->publish_context = GNUNET_FS_publish_start (daemon->fs,
                                                     fi,
index b7aba8ef4366c87093e17802fff6676579add016..769b4239d0f169f62354a6ae6a73ba57f76c0482 100644 (file)
 #include "platform.h"
 #include "gnunet_fs_service.h"
 
-/**
- * -a optiton.
- */
-static unsigned int anonymity;
-
 /**
  * -C option
  */
@@ -56,9 +51,9 @@ static int print_local_only;
 static struct GNUNET_CONTAINER_MetaData *adv_metadata;
 
 /**
- * -p option.
+ * Our block options (-p, -r, -a).
  */
-static unsigned int priority = 365;
+static struct GNUNET_FS_BlockOptions bo = { { 2 * 365 * 24 * 60 * 60 * 1000LL  }, 1, 365, 1 };
 
 /**
  * -q option given.
@@ -279,9 +274,7 @@ run (void *cls,
                                             ksk_uri,
                                             ns,
                                             adv_metadata,
-                                            anonymity,
-                                            priority,                                       
-                                            expiration,
+                                            &bo,
                                             root_identifier,
                                             &post_advertising,
                                             NULL);
@@ -307,7 +300,8 @@ run (void *cls,
 
 
 /**
- * The main function to inspect GNUnet directories.
+ * The main function to manipulate GNUnet pseudonyms (and publish
+ * to namespaces).
  *
  * @param argc number of arguments from the command line
  * @param argv command line arguments
@@ -319,7 +313,7 @@ main (int argc, char *const *argv)
   static const struct GNUNET_GETOPT_CommandLineOption options[] = {
     {'a', "anonymity", "LEVEL",
      gettext_noop ("set the desired LEVEL of sender-anonymity"),
-     1, &GNUNET_GETOPT_set_uint, &anonymity},
+     1, &GNUNET_GETOPT_set_uint, &bo.anonymity_level},
     {'C', "create", "NAME",
      gettext_noop
      ("create or advertise namespace NAME"),
@@ -341,11 +335,14 @@ main (int argc, char *const *argv)
      0, &GNUNET_GETOPT_set_one, &print_local_only},
     {'p', "priority", "PRIORITY",
      gettext_noop ("use the given PRIORITY for the advertisments"),
-     1, &GNUNET_GETOPT_set_uint, &priority},
+     1, &GNUNET_GETOPT_set_uint, &bo.content_priority},
     {'q', "quiet", NULL,
      gettext_noop ("do not print names of remote namespaces"),
      0, &GNUNET_GETOPT_set_one, &no_remote_printing},
-    {'r', "root", "ID",
+    {'r', "replication", "LEVEL",
+     gettext_noop ("set the desired replication LEVEL"),
+     0, &GNUNET_GETOPT_set_uint, &bo.replication_level},
+    {'R', "root", "ID",
      gettext_noop
      ("specify ID of the root of the namespace"),
      1, &GNUNET_GETOPT_set_string, &root_identifier},
index 2021a98165cf05d95e74b3f466a248f71a24e5c2..1fbdb9e07a1856156d5b67103c91f396442ba424 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009, 2010 Christian Grothoff (and other contributing authors)
+     (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009, 2010, 2011 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -28,8 +28,6 @@
 #include "platform.h"
 #include "gnunet_fs_service.h"
 
-#define DEFAULT_EXPIRATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, 2)
-
 static int ret;
 
 static int verbose;
@@ -46,9 +44,7 @@ static struct GNUNET_FS_Uri *topKeywords;
 
 static struct GNUNET_FS_Uri *uri;
 
-static unsigned int anonymity = 1;
-
-static unsigned int priority = 365;
+static struct GNUNET_FS_BlockOptions bo = { { 2 * 365 * 24 * 60 * 60 * 1000LL  }, 1, 365, 1 };
 
 static char *uri_string;
 
@@ -240,10 +236,8 @@ keyword_printer (void *cls,
  * @param length length of the file or directory
  * @param m metadata for the file or directory (can be modified)
  * @param uri pointer to the keywords that will be used for this entry (can be modified)
- * @param anonymity pointer to selected anonymity level (can be modified)
- * @param priority pointer to selected priority (can be modified)
+ * @param bo block options
  * @param do_index should we index?
- * @param expirationTime pointer to selected expiration time (can be modified)
  * @param client_info pointer to client context set upon creation (can be modified)
  * @return GNUNET_OK to continue, GNUNET_NO to remove
  *         this entry from the directory, GNUNET_SYSERR
@@ -255,10 +249,8 @@ publish_inspector (void *cls,
                   uint64_t length,
                   struct GNUNET_CONTAINER_MetaData *m,
                   struct GNUNET_FS_Uri **uri,
-                  unsigned int *anonymity,
-                  unsigned int *priority,
+                  struct GNUNET_FS_BlockOptions *bo,
                   int *do_index,
-                  struct GNUNET_TIME_Absolute *expirationTime,
                   void **client_info)
 {
   char *fn;
@@ -375,9 +367,7 @@ uri_ksk_continuation (void *cls,
                                 next_id,
                                 meta,
                                 uri,
-                                GNUNET_TIME_relative_to_absolute (DEFAULT_EXPIRATION),
-                                anonymity,
-                                priority,
+                                &bo,
                                 GNUNET_FS_PUBLISH_OPTION_NONE,
                                 uri_sks_continuation,
                                 NULL);
@@ -517,9 +507,7 @@ run (void *cls,
                             topKeywords,
                             meta,
                             uri,
-                            GNUNET_TIME_relative_to_absolute (DEFAULT_EXPIRATION),
-                            anonymity,
-                            priority,
+                            &bo,
                             GNUNET_FS_PUBLISH_OPTION_NONE,
                             &uri_ksk_continuation,
                             NULL);
@@ -557,9 +545,7 @@ run (void *cls,
                                                             &GNUNET_FS_directory_scanner_default,
                                                             plugins,
                                                             !do_insert,
-                                                            anonymity,
-                                                            priority,
-                                                            GNUNET_TIME_relative_to_absolute (DEFAULT_EXPIRATION),
+                                                            &bo,
                                                             &emsg);
     }
   else
@@ -576,9 +562,7 @@ run (void *cls,
                                                        keywords,
                                                        NULL,
                                                        !do_insert,
-                                                       anonymity,
-                                                       priority,
-                                                       GNUNET_TIME_relative_to_absolute (DEFAULT_EXPIRATION));
+                                                       &bo);
       GNUNET_break (fi != NULL);
       GNUNET_FS_uri_destroy (keywords);
     }
@@ -644,7 +628,7 @@ main (int argc, char *const *argv)
   static const struct GNUNET_GETOPT_CommandLineOption options[] = {
     {'a', "anonymity", "LEVEL",
      gettext_noop ("set the desired LEVEL of sender-anonymity"),
-     1, &GNUNET_GETOPT_set_uint, &anonymity},
+     1, &GNUNET_GETOPT_set_uint, &bo.anonymity_level},
     {'d', "disable-creation-time", NULL,
      gettext_noop
      ("disable adding the creation time to the metadata of the uploaded file"),
@@ -676,11 +660,14 @@ main (int argc, char *const *argv)
      1, &GNUNET_GETOPT_set_string, &next_id},
     {'p', "priority", "PRIORITY",
      gettext_noop ("specify the priority of the content"),
-     1, &GNUNET_GETOPT_set_uint, &priority},
+     1, &GNUNET_GETOPT_set_uint, &bo.content_priority},
     {'P', "pseudonym", "NAME",
      gettext_noop
      ("publish the files under the pseudonym NAME (place file into namespace)"),
      1, &GNUNET_GETOPT_set_string, &pseudonym},
+    {'r', "replication", "LEVEL",
+     gettext_noop ("set the desired replication LEVEL"),
+     0, &GNUNET_GETOPT_set_uint, &bo.replication_level},
     {'s', "simulate-only", NULL,
      gettext_noop ("only simulate the process but do not do any "
                   "actual publishing (useful to compute URIs)"),
index 74a88e7b2e5a2208bab22368fa18b16646a084c5..caf534140ff69e29bb555a012af5ac2072caf197 100644 (file)
@@ -1432,9 +1432,9 @@ gather_migration_blocks (void *cls,
   mig_task = GNUNET_SCHEDULER_NO_TASK;
   if (dsh != NULL)
     {
-      mig_qe = GNUNET_DATASTORE_get_random (dsh, 0, UINT_MAX,
-                                           GNUNET_TIME_UNIT_FOREVER_REL,
-                                           &process_migration_content, NULL);
+      mig_qe = GNUNET_DATASTORE_get_for_replication (dsh, 0, UINT_MAX,
+                                                    GNUNET_TIME_UNIT_FOREVER_REL,
+                                                    &process_migration_content, NULL);
       GNUNET_assert (mig_qe != NULL);
     }
 }
@@ -3764,8 +3764,10 @@ handle_p2p_put (void *cls,
       GNUNET_DATASTORE_put (dsh,
                            0, &query, dsize, &put[1],
                            type, prq.priority, 1 /* anonymity */, 
+                           0 /* replication */,
                            expiration, 
-                           1 + prq.priority, MAX_DATASTORE_QUEUE,
+                           1 + prq.priority, 
+                           MAX_DATASTORE_QUEUE,
                            GNUNET_CONSTANTS_SERVICE_TIMEOUT,
                            &put_migration_continuation, 
                            start);
index acfb95600694f44e41b2d35869686a16eb64b406..20a98e6f24721285a357c1ac51882c5d6b1e2264 100644 (file)
@@ -523,7 +523,7 @@ main_init (struct GNUNET_SERVER_Handle *server,
   };
 
   GSF_core = GNUNET_CORE_connect (GSF_cfg,
-                                 1, /* larger? */
+                                 2, /* larger? */
                                  NULL,
                                  &peer_init_handler,
                                  &peer_connect_handler,
index f6b31c4e2bb3c6f4b5551d21a0c99d93541d6d59..c44a658df0dcd9f17cf9dce929376b69695a844b 100644 (file)
@@ -915,6 +915,7 @@ handle_dht_reply (void *cls,
       GNUNET_DATASTORE_put (GSF_dsh,
                            0, key, size, data,
                            type, prq.priority, 1 /* anonymity */, 
+                           0 /* replication */,
                            exp, 
                            1 + prq.priority, MAX_DATASTORE_QUEUE,
                            GNUNET_CONSTANTS_SERVICE_TIMEOUT,
@@ -1237,6 +1238,7 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp,
       GNUNET_DATASTORE_put (GSF_dsh,
                            0, &query, dsize, &put[1],
                            type, prq.priority, 1 /* anonymity */, 
+                           0 /* replication */,
                            expiration, 
                            1 + prq.priority, MAX_DATASTORE_QUEUE,
                            GNUNET_CONSTANTS_SERVICE_TIMEOUT,
index 38d91683299ff0c91210f0f7af2695b20a0f3a32..0944892739017d01223a3dd1a6ad0c51e5f7bf90 100644 (file)
@@ -576,10 +576,10 @@ gather_migration_blocks (void *cls,
     return;
   if (GSF_dsh != NULL)
     {
-      mig_qe = GNUNET_DATASTORE_get_random (GSF_dsh, 
-                                           0, UINT_MAX,
-                                           GNUNET_TIME_UNIT_FOREVER_REL,
-                                           &process_migration_content, NULL);
+      mig_qe = GNUNET_DATASTORE_get_for_replication (GSF_dsh, 
+                                                    0, UINT_MAX,
+                                                    GNUNET_TIME_UNIT_FOREVER_REL,
+                                                    &process_migration_content, NULL);
       GNUNET_assert (mig_qe != NULL);
     }
 }
index 5091c5a6116c0021f1c818b5ca20e8ef9ddde824..35592225a3fd3b6f8756bb25f129a52195be4d4a 100644 (file)
@@ -295,6 +295,7 @@ run (void *cls,
   struct GNUNET_FS_Uri *kuri;
   struct GNUNET_FS_FileInformation *fi;
   size_t i;
+  struct GNUNET_FS_BlockOptions bo;
 
   setup_peer (&p1, "test_fs_download_data.conf");
   fs = GNUNET_FS_start (cfg,
@@ -309,6 +310,10 @@ run (void *cls,
     buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256);
   meta = GNUNET_CONTAINER_meta_data_create ();
   kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
+  bo.content_priority = 42;
+  bo.anonymity_level = 1;
+  bo.replication_level = 0;
+  bo.expiration_time = GNUNET_TIME_relative_to_absolute (LIFETIME); 
   fi = GNUNET_FS_file_information_create_from_data (fs,
                                                    "publish-context",
                                                    FILESIZE,
@@ -316,9 +321,7 @@ run (void *cls,
                                                    kuri,
                                                    meta,
                                                    GNUNET_NO,
-                                                   1,
-                                                   42,
-                                                   GNUNET_TIME_relative_to_absolute (LIFETIME)); 
+                                                   &bo);
   GNUNET_FS_uri_destroy (kuri);
   GNUNET_CONTAINER_meta_data_destroy (meta);
   GNUNET_assert (NULL != fi);
index 33ca42a168edd80582a5adc5cc8ef96b5732a8d1..afb544f518f874417c3d243ccdfc83d9b93b53cc 100644 (file)
@@ -294,6 +294,7 @@ run (void *cls,
   struct GNUNET_CONTAINER_MetaData *meta;
   struct GNUNET_FS_Uri *kuri;
   struct GNUNET_FS_FileInformation *fi;
+  struct GNUNET_FS_BlockOptions bo;
   size_t i;
 
   setup_peer (&p1, "test_fs_download_data.conf");
@@ -317,15 +318,17 @@ run (void *cls,
   GNUNET_free (buf);
   meta = GNUNET_CONTAINER_meta_data_create ();
   kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
+  bo.content_priority = 42;
+  bo.anonymity_level = 1;
+  bo.replication_level = 0;
+  bo.expiration_time = GNUNET_TIME_relative_to_absolute (LIFETIME); 
   fi = GNUNET_FS_file_information_create_from_file (fs,
                                                    "publish-context",
                                                    fn1,
                                                    kuri,
                                                    meta,
                                                    GNUNET_YES,
-                                                   1,
-                                                   42,
-                                                   GNUNET_TIME_relative_to_absolute (LIFETIME)); 
+                                                   &bo);
   GNUNET_FS_uri_destroy (kuri);
   GNUNET_CONTAINER_meta_data_destroy (meta);
   GNUNET_assert (NULL != fi);
index 0ea7a5524b627314908f4998deebcdfaac416f11..035cbb55ef9c1b5f3fac3851c49b8e3af7cce0d3 100644 (file)
@@ -359,6 +359,7 @@ run (void *cls,
   struct GNUNET_FS_Uri *kuri;
   struct GNUNET_FS_FileInformation *fi;
   size_t i;
+  struct GNUNET_FS_BlockOptions bo;
 
   cfg = c;
   setup_peer (&p1, "test_fs_download_data.conf");
@@ -374,6 +375,10 @@ run (void *cls,
     buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256);
   meta = GNUNET_CONTAINER_meta_data_create ();
   kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
+  bo.content_priority = 42;
+  bo.anonymity_level = 1;
+  bo.replication_level = 0;
+  bo.expiration_time = GNUNET_TIME_relative_to_absolute (LIFETIME); 
   fi = GNUNET_FS_file_information_create_from_data (fs,
                                                    "publish-context",
                                                    FILESIZE,
@@ -381,9 +386,7 @@ run (void *cls,
                                                    kuri,
                                                    meta,
                                                    GNUNET_NO,
-                                                   1,
-                                                   42,
-                                                   GNUNET_TIME_relative_to_absolute (LIFETIME)); 
+                                                   &bo);
   GNUNET_FS_uri_destroy (kuri);
   GNUNET_CONTAINER_meta_data_destroy (meta);
   GNUNET_assert (NULL != fi);
index 914dbad9fdec74eb01a990d965b5aadcfa4573d1..00e3c221176e73beb22f33d1b288cfaf07cf97ee 100644 (file)
@@ -55,10 +55,8 @@ mycleaner(void *cls,
          uint64_t length,
          struct GNUNET_CONTAINER_MetaData *meta,
          struct GNUNET_FS_Uri **uri,
-         uint32_t *anonymity,
-         uint32_t *priority,
+         struct GNUNET_FS_BlockOptions *bo,
          int *do_index,
-         struct GNUNET_TIME_Absolute *expirationTime,
          void **client_info)
 {
   return GNUNET_OK;
@@ -85,6 +83,7 @@ run (void *cls,
   struct GNUNET_FS_FileInformation *fidir;
   struct GNUNET_FS_Handle *fs;
   size_t i;
+  struct GNUNET_FS_BlockOptions bo;
 
   fs = GNUNET_FS_start (cfg, "test-fs-file-information", NULL, NULL,
                        GNUNET_FS_FLAGS_NONE,
@@ -112,16 +111,18 @@ run (void *cls,
   GNUNET_free (buf);
 
   meta = GNUNET_CONTAINER_meta_data_create ();
-  kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
+  kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords); 
+  bo.content_priority = 42;
+  bo.anonymity_level = 1;
+  bo.replication_level = 0;
+  bo.expiration_time = GNUNET_TIME_relative_to_absolute (LIFETIME); 
   fi1 = GNUNET_FS_file_information_create_from_file (fs,
                                                     "file_information-context1",
                                                     fn1,
                                                     kuri,
                                                     meta,
                                                     GNUNET_YES,
-                                                    1,
-                                                    42,
-                                                    GNUNET_TIME_relative_to_absolute (LIFETIME)); 
+                                                    &bo);
   GNUNET_assert (fi1 != NULL);
   fi2 = GNUNET_FS_file_information_create_from_file (fs,
                                                     "file_information-context2",
@@ -129,17 +130,13 @@ run (void *cls,
                                                     kuri,
                                                     meta,
                                                     GNUNET_YES,
-                                                    1,
-                                                    42,
-                                                    GNUNET_TIME_relative_to_absolute (LIFETIME)); 
+                                                    &bo);
   GNUNET_assert (fi2 != NULL);
   fidir = GNUNET_FS_file_information_create_empty_directory (fs,
                                                             "file_information-context-dir",
                                                             kuri,
                                                             meta,
-                                                            1,
-                                                            42,
-                                                            GNUNET_TIME_relative_to_absolute (LIFETIME)); 
+                                                            &bo);
   GNUNET_assert (GNUNET_OK == GNUNET_FS_file_information_add (fidir, fi1));
   GNUNET_assert (GNUNET_OK == GNUNET_FS_file_information_add (fidir, fi2));
   GNUNET_FS_uri_destroy (kuri);
index ec3d6fecd33bb277ad9ae532a1faf53762f0d061..d53732eaf3de2ac576c11ae07990aac2bfbd612c 100644 (file)
@@ -239,6 +239,7 @@ run (void *cls,
   struct GNUNET_FS_FileInformation *fi2;
   struct GNUNET_FS_FileInformation *fidir;
   size_t i;
+  struct GNUNET_FS_BlockOptions bo;
 
   setup_peer (&p1, "test_fs_list_indexed_data.conf");
   fs = GNUNET_FS_start (cfg,
@@ -272,33 +273,33 @@ run (void *cls,
 
   meta = GNUNET_CONTAINER_meta_data_create ();
   kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
+  bo.content_priority = 42;
+  bo.anonymity_level = 1;
+  bo.replication_level = 0;
+  bo.expiration_time = GNUNET_TIME_relative_to_absolute (LIFETIME); 
   fi1 = GNUNET_FS_file_information_create_from_file (fs,
                                                     "list_indexed-context1",
                                                     fn1,
                                                     kuri,
                                                     meta,
                                                     GNUNET_YES,
-                                                    1,
-                                                    42,
-                                                    GNUNET_TIME_relative_to_absolute (LIFETIME)); 
+                                                    &bo);
   GNUNET_assert (NULL != fi1);
+  bo.anonymity_level = 2;
   fi2 = GNUNET_FS_file_information_create_from_file (fs,
                                                     "list_indexed-context2",
                                                     fn2,
                                                     kuri,
                                                     meta,
                                                     GNUNET_YES,
-                                                    2,
-                                                    42,
-                                                    GNUNET_TIME_relative_to_absolute (LIFETIME)); 
+                                                    &bo);
   GNUNET_assert (NULL != fi2);
+  bo.anonymity_level = 3;
   fidir = GNUNET_FS_file_information_create_empty_directory (fs,
                                                             "list_indexed-context-dir",
                                                             kuri,
                                                             meta,
-                                                            3,
-                                                            42,
-                                                            GNUNET_TIME_relative_to_absolute (LIFETIME)); 
+                                                            &bo);
   GNUNET_assert (GNUNET_OK == GNUNET_FS_file_information_add (fidir, fi1));
   GNUNET_assert (GNUNET_OK == GNUNET_FS_file_information_add (fidir, fi2));
   GNUNET_FS_uri_destroy (kuri);
index 11b6ef8c275c1770444eeac607d04d0947c7bba6..02bb62807e52fcab199dcaac05855f820561f77e 100644 (file)
@@ -275,22 +275,24 @@ sks_cont (void *cls,
          const char *emsg)
 {
   struct GNUNET_CONTAINER_MetaData *meta;
-  struct GNUNET_TIME_Absolute expiration;
   struct GNUNET_FS_Uri *ksk_uri;
   char * msg;
+  struct GNUNET_FS_BlockOptions bo;
 
-  expiration = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES);
   meta = GNUNET_CONTAINER_meta_data_create ();
   msg = NULL;
   ksk_uri = GNUNET_FS_uri_parse ("gnunet://fs/ksk/ns-search", &msg);
   GNUNET_assert (NULL == msg);
   ksk_expect_uri = GNUNET_FS_uri_dup (uri);
+  bo.content_priority = 1;
+  bo.anonymity_level = 1;
+  bo.replication_level = 0;
+  bo.expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES);
   GNUNET_FS_publish_ksk (fs,
                         ksk_uri,
                         meta,
                         uri,
-                        expiration,
-                        1, 1,
+                        &bo,
                         GNUNET_FS_PUBLISH_OPTION_NONE,
                         &publish_cont,
                         NULL);
@@ -306,7 +308,7 @@ adv_cont (void *cls,
 {
   struct GNUNET_CONTAINER_MetaData *meta;
   struct GNUNET_FS_Namespace *ns;
-  struct GNUNET_TIME_Absolute expiration;
+  struct GNUNET_FS_BlockOptions bo;
 
   if (NULL != emsg)
     {
@@ -315,21 +317,23 @@ adv_cont (void *cls,
       GNUNET_FS_stop (fs);
       return;
     }
-  expiration = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES);
   ns = GNUNET_FS_namespace_create (fs,
                                   "testNamespace");
   GNUNET_assert (NULL != ns);
   meta = GNUNET_CONTAINER_meta_data_create ();
   GNUNET_assert (NULL == emsg);
   sks_expect_uri = GNUNET_FS_uri_dup (uri);
+  bo.content_priority = 1;
+  bo.anonymity_level = 1;
+  bo.replication_level = 0;
+  bo.expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES);
   GNUNET_FS_publish_sks (fs,
                         ns,
                         "this",
                         "next",
                         meta,
                         uri, /* FIXME: this is non-sense (use CHK URI!?) */
-                        expiration,
-                        1, 1,
+                        &bo,
                         GNUNET_FS_PUBLISH_OPTION_NONE,
                         &sks_cont,
                         NULL);
@@ -357,7 +361,7 @@ static void
 testNamespace ()
 {
   struct GNUNET_FS_Namespace *ns;
-  struct GNUNET_TIME_Absolute expiration;
+  struct GNUNET_FS_BlockOptions bo;
   struct GNUNET_CONTAINER_MetaData *meta;
   struct GNUNET_FS_Uri *ksk_uri;
   int ok;
@@ -375,15 +379,17 @@ testNamespace ()
       err = 1;
       return;
     }
-  expiration = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES);
   meta = GNUNET_CONTAINER_meta_data_create ();
   ksk_uri = GNUNET_FS_uri_parse ("gnunet://fs/ksk/testnsa", NULL);
+  bo.content_priority = 1;
+  bo.anonymity_level = 1;
+  bo.replication_level = 0;
+  bo.expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES);
   GNUNET_FS_namespace_advertise (fs,
                                 ksk_uri,
                                 ns,
                                 meta,
-                                1, 1,
-                                expiration,                                       
+                                &bo,
                                 "root",
                                 &adv_cont, NULL);
   kill_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
index 359800f56f352c5de49e96db5a058c73ea3f0087..dda7bb4f2147f77b2471c207572178a11fc8fb7c 100644 (file)
@@ -40,14 +40,14 @@ static int err;
 
 static struct GNUNET_FS_Namespace *ns;
 
-static struct GNUNET_TIME_Absolute expiration;
-
 static struct GNUNET_CONTAINER_MetaData *meta;
 
 static struct GNUNET_FS_Uri *uri_this;
 
 static struct GNUNET_FS_Uri *uri_next;
 
+static struct GNUNET_FS_BlockOptions bo;
+
 
 struct PeerContext
 {
@@ -172,6 +172,7 @@ sks_cont_this (void *cls,
               const struct GNUNET_FS_Uri *uri,
               const char *emsg)
 {
+
   GNUNET_assert (NULL == emsg);
   err = 1;
   GNUNET_FS_namespace_list_updateable (ns,
@@ -184,8 +185,7 @@ sks_cont_this (void *cls,
                         "future",
                         meta,
                         uri_next,
-                        expiration,
-                        1, 1,
+                        &bo,
                         GNUNET_FS_PUBLISH_OPTION_NONE,
                         &sks_cont_next,
                         NULL);
@@ -201,7 +201,10 @@ testNamespace ()
   ns = GNUNET_FS_namespace_create (fs,
                                   "testNamespace");
   GNUNET_assert (NULL != ns);
-  expiration = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES);
+  bo.content_priority = 1;
+  bo.anonymity_level = 1;
+  bo.replication_level = 0;
+  bo.expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES);
   meta = GNUNET_CONTAINER_meta_data_create ();
 
   uri_this =
@@ -214,8 +217,7 @@ testNamespace ()
                         "next",
                         meta,
                         uri_this,
-                        expiration,
-                        1, 1,
+                        &bo,
                         GNUNET_FS_PUBLISH_OPTION_NONE,
                         &sks_cont_this,
                         NULL);
index 99d4b6710388c9d1325bf14ae4995178fbc0e8ef..b206fb415293d4b3c30a82278526fda91e0eff9b 100644 (file)
@@ -225,6 +225,7 @@ run (void *cls,
   struct GNUNET_FS_FileInformation *fi2;
   struct GNUNET_FS_FileInformation *fidir;
   size_t i;
+  struct GNUNET_FS_BlockOptions bo;
 
   setup_peer (&p1, "test_fs_publish_data.conf");
   fs = GNUNET_FS_start (cfg,
@@ -258,33 +259,35 @@ run (void *cls,
 
   meta = GNUNET_CONTAINER_meta_data_create ();
   kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
+  bo.content_priority = 42;
+  bo.anonymity_level = 1;
+  bo.replication_level = 0;
+  bo.expiration_time = GNUNET_TIME_relative_to_absolute (LIFETIME);
+
   fi1 = GNUNET_FS_file_information_create_from_file (fs,
                                                     "publish-context1",
                                                     fn1,
                                                     kuri,
                                                     meta,
                                                     GNUNET_YES,
-                                                    1,
-                                                    42,
-                                                    GNUNET_TIME_relative_to_absolute (LIFETIME)); 
+                                                    &bo);
+                                                    
   GNUNET_assert (NULL != fi1);
+  bo.anonymity_level = 2;
   fi2 = GNUNET_FS_file_information_create_from_file (fs,
                                                     "publish-context2",
                                                     fn2,
                                                     kuri,
                                                     meta,
                                                     GNUNET_YES,
-                                                    2,
-                                                    42,
-                                                    GNUNET_TIME_relative_to_absolute (LIFETIME)); 
+                                                    &bo);
   GNUNET_assert (NULL != fi2);
+  bo.anonymity_level = 3;
   fidir = GNUNET_FS_file_information_create_empty_directory (fs,
                                                             "publish-context-dir",
                                                             kuri,
                                                             meta,
-                                                            3,
-                                                            42,
-                                                            GNUNET_TIME_relative_to_absolute (LIFETIME)); 
+                                                            &bo);
   GNUNET_assert (GNUNET_OK == GNUNET_FS_file_information_add (fidir, fi1));
   GNUNET_assert (GNUNET_OK == GNUNET_FS_file_information_add (fidir, fi2));
   GNUNET_FS_uri_destroy (kuri);
index 4a84bf9dc7c4991b8321e23ddff9e79fb8a3456f..1610c25c1bcc50bd483b67a8c0e6c3df9472dc52 100644 (file)
@@ -282,6 +282,7 @@ run (void *cls,
   struct GNUNET_FS_FileInformation *fi2;
   struct GNUNET_FS_FileInformation *fidir;
   size_t i;
+  struct GNUNET_FS_BlockOptions bo;
 
   cfg = c;
   setup_peer (&p1, "test_fs_publish_data.conf");
@@ -316,33 +317,33 @@ run (void *cls,
 
   meta = GNUNET_CONTAINER_meta_data_create ();
   kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
+  bo.content_priority = 42;
+  bo.anonymity_level = 1;
+  bo.replication_level = 0;
+  bo.expiration_time = GNUNET_TIME_relative_to_absolute (LIFETIME); 
   fi1 = GNUNET_FS_file_information_create_from_file (fs,
                                                     "publish-context1",
                                                     fn1,
                                                     kuri,
                                                     meta,
                                                     GNUNET_YES,
-                                                    1,
-                                                    42,
-                                                    GNUNET_TIME_relative_to_absolute (LIFETIME)); 
+                                                    &bo);
   GNUNET_assert (NULL != fi1);
+  bo.anonymity_level = 2;
   fi2 = GNUNET_FS_file_information_create_from_file (fs,
                                                     "publish-context2",
                                                     fn2,
                                                     kuri,
                                                     meta,
                                                     GNUNET_YES,
-                                                    2,
-                                                    42,
-                                                    GNUNET_TIME_relative_to_absolute (LIFETIME)); 
+                                                    &bo);
   GNUNET_assert (NULL != fi2);
+  bo.anonymity_level = 3;
   fidir = GNUNET_FS_file_information_create_empty_directory (fs,
                                                             "publish-context-dir",
                                                             kuri,
                                                             meta,
-                                                            3,
-                                                            42,
-                                                            GNUNET_TIME_relative_to_absolute (LIFETIME)); 
+                                                            &bo);
   GNUNET_assert (GNUNET_OK == GNUNET_FS_file_information_add (fidir, fi1));
   GNUNET_assert (GNUNET_OK == GNUNET_FS_file_information_add (fidir, fi2));
   GNUNET_FS_uri_destroy (kuri);
index 2544b8a6e73140919ff2677bc5a0eacbb42d8fe2..0c44cb612b638943339ab7685ea03538b65b529b 100644 (file)
@@ -226,6 +226,7 @@ run (void *cls,
   char *buf;
   struct GNUNET_CONTAINER_MetaData *meta;
   struct GNUNET_FS_Uri *kuri;
+  struct GNUNET_FS_BlockOptions bo;
   struct GNUNET_FS_FileInformation *fi;
   size_t i;
 
@@ -242,6 +243,10 @@ run (void *cls,
     buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256);
   meta = GNUNET_CONTAINER_meta_data_create ();
   kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
+  bo.content_priority = 42;
+  bo.anonymity_level = 1;
+  bo.replication_level = 0;
+  bo.expiration_time = GNUNET_TIME_relative_to_absolute (LIFETIME);
   fi = GNUNET_FS_file_information_create_from_data (fs,
                                                    "publish-context",
                                                    FILESIZE,
@@ -249,9 +254,7 @@ run (void *cls,
                                                    kuri,
                                                    meta,
                                                    GNUNET_NO,
-                                                   1,
-                                                   42,
-                                                   GNUNET_TIME_relative_to_absolute (LIFETIME)); 
+                                                   &bo);
   GNUNET_FS_uri_destroy (kuri);
   GNUNET_CONTAINER_meta_data_destroy (meta);
   GNUNET_assert (NULL != fi);
index e2a213cd86adfe682f1fb04e8f0e216b59035b54..f04dad9f3b15f7090e2f10959e491a632a9c0538 100644 (file)
@@ -297,6 +297,7 @@ run (void *cls,
   struct GNUNET_FS_Uri *kuri;
   struct GNUNET_FS_FileInformation *fi;
   size_t i;
+  struct GNUNET_FS_BlockOptions bo;
 
   cfg = c;
   setup_peer (&p1, "test_fs_search_data.conf");
@@ -312,6 +313,10 @@ run (void *cls,
     buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256);
   meta = GNUNET_CONTAINER_meta_data_create ();
   kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
+  bo.content_priority = 42;
+  bo.anonymity_level = 1;
+  bo.replication_level = 0;
+  bo.expiration_time = GNUNET_TIME_relative_to_absolute (LIFETIME);
   fi = GNUNET_FS_file_information_create_from_data (fs,
                                                    "publish-context",
                                                    FILESIZE,
@@ -319,9 +324,7 @@ run (void *cls,
                                                    kuri,
                                                    meta,
                                                    GNUNET_NO,
-                                                   1,
-                                                   42,
-                                                   GNUNET_TIME_relative_to_absolute (LIFETIME)); 
+                                                   &bo);
   GNUNET_FS_uri_destroy (kuri);
   GNUNET_CONTAINER_meta_data_destroy (meta);
   GNUNET_assert (NULL != fi);
index 82d4cdcf705b22b2ada07eb07fe480eb7c770d1e..99611a6c8f3ec93c9a20c8bfe6061371d80c1fe4 100644 (file)
@@ -233,6 +233,7 @@ run (void *cls,
   struct GNUNET_FS_Uri *kuri;
   struct GNUNET_FS_FileInformation *fi;
   size_t i;
+  struct GNUNET_FS_BlockOptions bo;
 
   setup_peer (&p1, "test_fs_unindex_data.conf");
   fn = GNUNET_DISK_mktemp ("gnunet-unindex-test-dst");
@@ -254,15 +255,17 @@ run (void *cls,
   GNUNET_free (buf);
   meta = GNUNET_CONTAINER_meta_data_create ();
   kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
+  bo.content_priority = 42;
+  bo.anonymity_level = 1;
+  bo.replication_level = 0;
+  bo.expiration_time = GNUNET_TIME_relative_to_absolute (LIFETIME);
   fi = GNUNET_FS_file_information_create_from_file (fs,
                                                    "publish-context",
                                                    fn,
                                                    kuri,
                                                    meta,
                                                    GNUNET_YES,
-                                                   1,
-                                                   42,
-                                                   GNUNET_TIME_relative_to_absolute (LIFETIME)); 
+                                                   &bo);
   GNUNET_FS_uri_destroy (kuri);
   GNUNET_CONTAINER_meta_data_destroy (meta);
   GNUNET_assert (NULL != fi);
index 162dd59af5ac2d65433deeb7a7272e13a47a8879..ee4a4c2dba7fd8e165565b8c38e71978a31fc661 100644 (file)
@@ -301,6 +301,7 @@ run (void *cls,
   struct GNUNET_FS_Uri *kuri;
   struct GNUNET_FS_FileInformation *fi;
   size_t i;
+  struct GNUNET_FS_BlockOptions bo;
 
   cfg = c;
   setup_peer (&p1, "test_fs_unindex_data.conf");
@@ -323,15 +324,17 @@ run (void *cls,
   GNUNET_free (buf);
   meta = GNUNET_CONTAINER_meta_data_create ();
   kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
+  bo.content_priority = 42;
+  bo.anonymity_level = 1;
+  bo.replication_level = 0;
+  bo.expiration_time = GNUNET_TIME_relative_to_absolute (LIFETIME);
   fi = GNUNET_FS_file_information_create_from_file (fs,
                                                    "publish-context",
                                                    fn,
                                                    kuri,
                                                    meta,
                                                    GNUNET_YES,
-                                                   1,
-                                                   42,
-                                                   GNUNET_TIME_relative_to_absolute (LIFETIME)); 
+                                                   &bo);
   GNUNET_FS_uri_destroy (kuri);
   GNUNET_CONTAINER_meta_data_destroy (meta);
   GNUNET_assert (NULL != fi);
index e9cb8a76fe4f5f14cc0d058ed7cc52c660a130fb..1e2e9e0505fdb97a2ad14c86a8f903da2dc10aca 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet
-     (C) 2004, 2005, 2006, 2007, 2009, 2010 Christian Grothoff (and other contributing authors)
+     (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -122,8 +122,8 @@ GNUNET_DATASTORE_reserve (struct GNUNET_DATASTORE_Handle *h,
 
 /**
  * Store an item in the datastore.  If the item is already present,
- * the priorities are summed up and the higher expiration time and
- * lower anonymity level is used.
+ * the priorities and replication values are summed up and the higher
+ * expiration time and lower anonymity level is used.
  *
  * @param h handle to the datastore
  * @param rid reservation ID to use (from "reserve"); use 0 if no
@@ -134,6 +134,7 @@ GNUNET_DATASTORE_reserve (struct GNUNET_DATASTORE_Handle *h,
  * @param type type of the content
  * @param priority priority of the content
  * @param anonymity anonymity-level for the content
+ * @param replication how often should the content be replicated to other peers?
  * @param expiration expiration time for the content
  * @param queue_priority ranking of this request in the priority queue
  * @param max_queue_size at what queue size should this request be dropped
@@ -154,6 +155,7 @@ GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h,
                       enum GNUNET_BLOCK_Type type,
                       uint32_t priority,
                       uint32_t anonymity,
+                     uint32_t replication,
                       struct GNUNET_TIME_Absolute expiration,
                      unsigned int queue_priority,
                      unsigned int max_queue_size,
@@ -323,7 +325,11 @@ GNUNET_DATASTORE_get_next (struct GNUNET_DATASTORE_Handle *h);
 
 
 /**
- * Get a random value from the datastore.
+ * Get a random value from the datastore for content replication.
+ * Returns a single, random value among those with the highest
+ * replication score, lowering positive replication scores by one for
+ * the chosen value (if only content with a replication score exists,
+ * a random value is returned and replication scores are not changed).
  *
  * @param h handle to the datastore
  * @param queue_priority ranking of this request in the priority queue
@@ -339,12 +345,12 @@ GNUNET_DATASTORE_get_next (struct GNUNET_DATASTORE_Handle *h);
  *         (or rather, will already have been invoked)
  */
 struct GNUNET_DATASTORE_QueueEntry *
-GNUNET_DATASTORE_get_random (struct GNUNET_DATASTORE_Handle *h,
-                            unsigned int queue_priority,
-                            unsigned int max_queue_size,
-                            struct GNUNET_TIME_Relative timeout,
-                             GNUNET_DATASTORE_Iterator iter, 
-                            void *iter_cls);
+GNUNET_DATASTORE_get_for_replication (struct GNUNET_DATASTORE_Handle *h,
+                                     unsigned int queue_priority,
+                                     unsigned int max_queue_size,
+                                     struct GNUNET_TIME_Relative timeout,
+                                     GNUNET_DATASTORE_Iterator iter, 
+                                     void *iter_cls);
 
 
 /**
index 52cd8bd78340b54f84e01311d880ccdf6bbdbee2..8238083b1ef7df4afc4518691d1e9f94335af9af 100644 (file)
@@ -1573,6 +1573,52 @@ enum GNUNET_FS_OPTIONS
   };
 
 
+/**
+ * Settings for publishing a block (which may of course also
+ * apply to an entire directory or file).
+ */
+struct GNUNET_FS_BlockOptions
+{
+
+  /**
+   * At what time should the block expire?  Data blocks (DBLOCKS and
+   * IBLOCKS) may still be used even if they are expired (however,
+   * they'd be removed quickly from the datastore if we are short on
+   * space), all other types of blocks will no longer be returned
+   * after they expire.
+   */
+  struct GNUNET_TIME_Absolute expiration_time;
+
+  /**
+   * At which anonymity level should the block be shared?
+   * (0: no anonymity, 1: normal GAP, >1: with cover traffic).
+   */
+  uint32_t anonymity_level;
+
+  /**
+   * How important is it for us to store the block?  If we run
+   * out of space, the highest-priority, non-expired blocks will
+   * be kept.
+   */
+  uint32_t content_priority;
+
+  /**
+   * How often should we try to migrate the block to other peers?
+   * Only used if "CONTENT_PUSHING" is set to YES, in which case we
+   * first push each block to other peers according to their
+   * replication levels.  Once each block has been pushed that many
+   * times to other peers, blocks are chosen for migration at random.
+   * Naturally, there is no guarantee that the other peers will keep
+   * these blocks for any period of time (since they won't have any
+   * priority or might be too busy to even store the block in the
+   * first place).
+   */
+  uint32_t replication_level;
+
+};
+
+
+
 /**
  * Handle to the file-sharing service.
  */
@@ -1635,10 +1681,8 @@ GNUNET_FS_meta_data_extract_from_file (struct
  * @param length length of the file or directory
  * @param meta metadata for the file or directory (can be modified)
  * @param uri pointer to the keywords that will be used for this entry (can be modified)
- * @param anonymity pointer to selected anonymity level (can be modified)
- * @param priority pointer to selected priority (can be modified)
+ * @param bo block options (can be modified)
  * @param do_index should we index (can be modified)
- * @param expirationTime pointer to selected expiration time (can be modified)
  * @param client_info pointer to client context set upon creation (can be modified)
  * @return GNUNET_OK to continue, GNUNET_NO to remove
  *         this entry from the directory, GNUNET_SYSERR
@@ -1649,10 +1693,8 @@ typedef int (*GNUNET_FS_FileInformationProcessor)(void *cls,
                                                  uint64_t length,
                                                  struct GNUNET_CONTAINER_MetaData *meta,
                                                  struct GNUNET_FS_Uri **uri,
-                                                 uint32_t *anonymity,
-                                                 uint32_t *priority,
+                                                 struct GNUNET_FS_BlockOptions *bo,
                                                  int *do_index,
-                                                 struct GNUNET_TIME_Absolute *expirationTime,
                                                  void **client_info);
 
 
@@ -1682,11 +1724,7 @@ GNUNET_FS_file_information_get_id (struct GNUNET_FS_FileInformation *s);
  * @param meta metadata for the file
  * @param do_index GNUNET_YES for index, GNUNET_NO for insertion,
  *                GNUNET_SYSERR for simulation
- * @param anonymity what is the desired anonymity level for sharing?
- * @param priority what is the priority for OUR node to
- *   keep this file available?  Use 0 for maximum anonymity and
- *   minimum reliability...
- * @param expirationTime when should this content expire?
+ * @param bo block options
  * @return publish structure entry for the file
  */
 struct GNUNET_FS_FileInformation *
@@ -1696,9 +1734,7 @@ GNUNET_FS_file_information_create_from_file (struct GNUNET_FS_Handle *h,
                                             const struct GNUNET_FS_Uri *keywords,
                                             const struct GNUNET_CONTAINER_MetaData *meta,
                                             int do_index,
-                                            uint32_t anonymity,
-                                            uint32_t priority,
-                                            struct GNUNET_TIME_Absolute expirationTime);
+                                            const struct GNUNET_FS_BlockOptions *bo);
 
 
 /**
@@ -1714,11 +1750,7 @@ GNUNET_FS_file_information_create_from_file (struct GNUNET_FS_Handle *h,
  * @param meta metadata for the file
  * @param do_index GNUNET_YES for index, GNUNET_NO for insertion,
  *                GNUNET_SYSERR for simulation
- * @param anonymity what is the desired anonymity level for sharing?
- * @param priority what is the priority for OUR node to
- *   keep this file available?  Use 0 for maximum anonymity and
- *   minimum reliability...
- * @param expirationTime when should this content expire?
+ * @param bo block options
  * @return publish structure entry for the file
  */
 struct GNUNET_FS_FileInformation *
@@ -1729,9 +1761,7 @@ GNUNET_FS_file_information_create_from_data (struct GNUNET_FS_Handle *h,
                                             const struct GNUNET_FS_Uri *keywords,
                                             const struct GNUNET_CONTAINER_MetaData *meta,
                                             int do_index,
-                                            uint32_t anonymity,
-                                            uint32_t priority,
-                                            struct GNUNET_TIME_Absolute expirationTime);
+                                            const struct GNUNET_FS_BlockOptions *bo);
 
 
 /**
@@ -1770,11 +1800,7 @@ typedef size_t (*GNUNET_FS_DataReader)(void *cls,
  * @param meta metadata for the file
  * @param do_index GNUNET_YES for index, GNUNET_NO for insertion,
  *                GNUNET_SYSERR for simulation
- * @param anonymity what is the desired anonymity level for sharing?
- * @param priority what is the priority for OUR node to
- *   keep this file available?  Use 0 for maximum anonymity and
- *   minimum reliability...
- * @param expirationTime when should this content expire?
+ * @param bo block options
  * @return publish structure entry for the file
  */
 struct GNUNET_FS_FileInformation *
@@ -1786,9 +1812,7 @@ GNUNET_FS_file_information_create_from_reader (struct GNUNET_FS_Handle *h,
                                               const struct GNUNET_FS_Uri *keywords,
                                               const struct GNUNET_CONTAINER_MetaData *meta,
                                               int do_index,
-                                              uint32_t anonymity,
-                                              uint32_t priority,
-                                              struct GNUNET_TIME_Absolute expirationTime);
+                                              const struct GNUNET_FS_BlockOptions *bo);
 
 
 /**
@@ -1813,9 +1837,7 @@ typedef void (*GNUNET_FS_FileProcessor)(void *cls,
  * @param h handle to the file sharing subsystem
  * @param dirname name of the directory to scan
  * @param do_index should files be indexed or inserted
- * @param anonymity desired anonymity level
- * @param priority priority for publishing
- * @param expirationTime expiration for publication
+ * @param bo block options
  * @param proc function to call on each entry
  * @param proc_cls closure for proc
  * @param emsg where to store an error message (on errors)
@@ -1825,9 +1847,7 @@ typedef int (*GNUNET_FS_DirectoryScanner)(void *cls,
                                          struct GNUNET_FS_Handle *h,
                                          const char *dirname,
                                          int do_index,
-                                         uint32_t anonymity,
-                                         uint32_t priority,
-                                         struct GNUNET_TIME_Absolute expirationTime,
+                                         const struct GNUNET_FS_BlockOptions *bo,
                                          GNUNET_FS_FileProcessor proc,
                                          void *proc_cls,
                                          char **emsg);
@@ -1849,9 +1869,7 @@ typedef int (*GNUNET_FS_DirectoryScanner)(void *cls,
  * @param h handle to the file sharing subsystem
  * @param dirname name of the directory to scan
  * @param do_index should files be indexed or inserted
- * @param anonymity desired anonymity level
- * @param priority priority for publishing
- * @param expirationTime expiration for publication
+ * @param bo block options
  * @param proc function called on each entry
  * @param proc_cls closure for proc
  * @param emsg where to store an error message (on errors)
@@ -1862,9 +1880,7 @@ GNUNET_FS_directory_scanner_default (void *cls,
                                     struct GNUNET_FS_Handle *h,
                                     const char *dirname,
                                     int do_index,
-                                    uint32_t anonymity,
-                                    uint32_t priority,
-                                    struct GNUNET_TIME_Absolute expirationTime,
+                                    const struct GNUNET_FS_BlockOptions *bo,
                                     GNUNET_FS_FileProcessor proc,
                                     void *proc_cls,
                                     char **emsg);
@@ -1886,11 +1902,7 @@ GNUNET_FS_directory_scanner_default (void *cls,
  * @param scanner function used to get a list of files in a directory
  * @param scanner_cls closure for scanner
  * @param do_index should files in the hierarchy be indexed?
- * @param anonymity what is the desired anonymity level for sharing?
- * @param priority what is the priority for OUR node to
- *   keep this file available?  Use 0 for maximum anonymity and
- *   minimum reliability...
- * @param expirationTime when should this content expire?
+ * @param bo block options
  * @param emsg where to store an error message
  * @return publish structure entry for the directory, NULL on error
  */
@@ -1901,9 +1913,7 @@ GNUNET_FS_file_information_create_from_directory (struct GNUNET_FS_Handle *h,
                                                  GNUNET_FS_DirectoryScanner scanner,
                                                  void *scanner_cls,
                                                  int do_index,
-                                                 uint32_t anonymity,
-                                                 uint32_t priority,
-                                                 struct GNUNET_TIME_Absolute expirationTime,
+                                                 const struct GNUNET_FS_BlockOptions *bo,
                                                  char **emsg);
 
 
@@ -1918,11 +1928,7 @@ GNUNET_FS_file_information_create_from_directory (struct GNUNET_FS_Handle *h,
  * @param keywords under which keywords should this directory be available
  *         directly; can be NULL
  * @param meta metadata for the directory
- * @param anonymity what is the desired anonymity level for sharing?
- * @param priority what is the priority for OUR node to
- *   keep this file available?  Use 0 for maximum anonymity and
- *   minimum reliability...
- * @param expirationTime when should this content expire?
+ * @param bo block options
  * @return publish structure entry for the directory , NULL on error
  */
 struct GNUNET_FS_FileInformation *
@@ -1930,9 +1936,7 @@ GNUNET_FS_file_information_create_empty_directory (struct GNUNET_FS_Handle *h,
                                                   void *client_info,
                                                   const struct GNUNET_FS_Uri *keywords,
                                                   const struct GNUNET_CONTAINER_MetaData *meta,
-                                                  uint32_t anonymity,
-                                                  uint32_t priority,
-                                                  struct GNUNET_TIME_Absolute expirationTime);
+                                                  const struct GNUNET_FS_BlockOptions *bo);
 
 
 /**
@@ -2069,9 +2073,8 @@ typedef void (*GNUNET_FS_PublishContinuation)(void *cls,
  * @param ksk_uri keywords 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
+ * @param bo block options
+ * @param options publication options
  * @param cont continuation
  * @param cont_cls closure for cont
  */
@@ -2080,9 +2083,7 @@ GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h,
                       const struct GNUNET_FS_Uri *ksk_uri,
                       const struct GNUNET_CONTAINER_MetaData *meta,
                       const struct GNUNET_FS_Uri *uri,
-                      struct GNUNET_TIME_Absolute expirationTime,
-                      uint32_t anonymity,
-                      uint32_t priority,
+                      const struct GNUNET_FS_BlockOptions *bo,
                       enum GNUNET_FS_PublishOptions options,
                       GNUNET_FS_PublishContinuation cont,
                       void *cont_cls);
@@ -2097,9 +2098,8 @@ GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h,
  * @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
+ * @param bo block options
+ * @param options publication options
  * @param cont continuation
  * @param cont_cls closure for cont
  */
@@ -2110,9 +2110,7 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h,
                       const char *update,
                       const struct GNUNET_CONTAINER_MetaData *meta,
                       const struct GNUNET_FS_Uri *uri,
-                      struct GNUNET_TIME_Absolute expirationTime,
-                      uint32_t anonymity,
-                      uint32_t priority,
+                      const struct GNUNET_FS_BlockOptions *bo,
                       enum GNUNET_FS_PublishOptions options,
                       GNUNET_FS_PublishContinuation cont,
                       void *cont_cls);
@@ -2180,9 +2178,7 @@ GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc);
  * @param ksk_uri keywords to use for advertisment
  * @param namespace handle for the namespace that should be advertised
  * @param meta meta-data for the namespace advertisement
- * @param anonymity for the namespace advertismement
- * @param priority for the namespace advertisement
- * @param expiration for the namespace advertisement
+ * @param bo block options
  * @param rootEntry name of the root of the namespace
  * @param cont continuation
  * @param cont_cls closure for cont
@@ -2192,9 +2188,7 @@ GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h,
                               struct GNUNET_FS_Uri *ksk_uri,
                               struct GNUNET_FS_Namespace *namespace,
                               const struct GNUNET_CONTAINER_MetaData *meta,
-                              uint32_t anonymity,
-                              uint32_t priority,
-                              struct GNUNET_TIME_Absolute expiration,
+                              const struct GNUNET_FS_BlockOptions *bo,
                               const char *rootEntry,
                               GNUNET_FS_PublishContinuation cont,
                               void *cont_cls);