[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r11038 - in gnunet: . src/fs
From: |
gnunet |
Subject: |
[GNUnet-SVN] r11038 - in gnunet: . src/fs |
Date: |
Thu, 22 Apr 2010 15:37:22 +0200 |
Author: grothoff
Date: 2010-04-22 15:37:22 +0200 (Thu, 22 Apr 2010)
New Revision: 11038
Modified:
gnunet/TODO
gnunet/src/fs/fs_download.c
Log:
adding temp_filename
Modified: gnunet/TODO
===================================================================
--- gnunet/TODO 2010-04-22 13:34:40 UTC (rev 11037)
+++ gnunet/TODO 2010-04-22 13:37:22 UTC (rev 11038)
@@ -1,13 +1,12 @@
0.9.0pre1:
* FS: [CG]
- - support recursive download even if filename is NULL and we hence
- do not generate files on disk (use temp_filename)
- bound parallelism (# fs downloads)
- distinguish in performance tracking and event signalling between
downloads that are actually running and those that are merely in the queue
- persistence support (publish, unindex, search, download)
- active migration support (in fs or in datastore or new daemon?)
- - gnunet-service-fs (hot-path routing, load-based routing, nitpicks)
+ - support for in-line files in directories (FIXME in fs_download)
+ - gnunet-service-fs (hot-path routing, load-based routing, nitpicks)
- [gnunet-service-fs.c:208]: member 'LocalGetContext::results_bf_size' is
never used
- [gnunet-service-fs.c:501]: member 'PendingRequest::used_pids_size' is
never used
- [gnunet-service-fs.c:654]: member 'ConnectedPeer::last_client_replies' is
never used
@@ -98,7 +97,10 @@
* MYSQL database backends: [CG]
- datacache
- datastore
+* FS:
+ - reconstruct IBLOCKS from DBLOCKS if possible (during download; see FIXME
in fs_download)
+
0.9.0:
* new webpage:
- expand bibliography
Modified: gnunet/src/fs/fs_download.c
===================================================================
--- gnunet/src/fs/fs_download.c 2010-04-22 13:34:40 UTC (rev 11037)
+++ gnunet/src/fs/fs_download.c 2010-04-22 13:37:22 UTC (rev 11038)
@@ -25,8 +25,6 @@
* TODO:
* - handle recursive downloads (need directory &
* fs-level download-parallelism management)
- * - handle recursive downloads where directory file is
- * NOT saved on disk (need temporary file instead then!)
* - location URI suppport (can wait, easy)
* - check if blocks exist already (can wait, easy)
* - check if iblocks can be computed from existing blocks (can wait, hard)
@@ -41,6 +39,24 @@
#define DEBUG_DOWNLOAD GNUNET_NO
/**
+ * Determine if the given download (options and meta data) should cause
+ * use to try to do a recursive download.
+ */
+static int
+is_recursive_download (struct GNUNET_FS_DownloadContext *dc)
+{
+ return (0 != (dc->options & GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE)) &&
+ ( (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (dc->meta)) ||
+ ( (dc->meta == NULL) &&
+ ( (NULL == dc->filename) ||
+ ( (strlen (dc->filename) >= strlen (GNUNET_FS_DIRECTORY_EXT)) &&
+ (NULL !=
+ strstr (dc->filename + strlen(dc->filename) -
strlen(GNUNET_FS_DIRECTORY_EXT),
+ GNUNET_FS_DIRECTORY_EXT)) ) ) ) );
+}
+
+
+/**
* We're storing the IBLOCKS after the DBLOCKS on disk (so that we
* only have to truncate the file once we're done).
*
@@ -293,7 +309,6 @@
block,
len)) )
{
- /* FIXME: also check query matches!? */
if (0 == memcmp (&key,
&chk->key,
sizeof (GNUNET_HashCode)))
@@ -698,9 +713,6 @@
}
else
{
- /* FIXME: need to initialize (and use) temp_filename
- in various places in order for this assertion to
- not fail; right now, it will always fail! */
GNUNET_assert (dc->temp_filename != NULL);
h = GNUNET_DISK_file_open (dc->temp_filename,
GNUNET_DISK_OPEN_READ,
@@ -917,14 +929,7 @@
/* do recursive download if option is set and either meta data
says it is a directory or if no meta data is given AND filename
ends in '.gnd' (top-level case) */
- if ( (0 != (dc->options & GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE)) &&
- ( (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (dc->meta))
||
- ( (dc->meta == NULL) &&
- ( (NULL == dc->filename) ||
- ( (strlen (dc->filename) >= strlen (GNUNET_FS_DIRECTORY_EXT))
&&
- (NULL !=
- strstr (dc->filename + strlen(dc->filename) -
strlen(GNUNET_FS_DIRECTORY_EXT),
- GNUNET_FS_DIRECTORY_EXT)) ) ) ) ) )
+ if (is_recursive_download (dc))
GNUNET_FS_directory_list_contents (prc->size,
pt,
off,
@@ -960,14 +965,7 @@
dc->filename);
}
- if ( (0 != (dc->options & GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE)) &&
- ( (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (dc->meta))
||
- ( (dc->meta == NULL) &&
- ( (NULL == dc->filename) ||
- ( (strlen (dc->filename) >= strlen (GNUNET_FS_DIRECTORY_EXT))
&&
- (NULL !=
- strstr (dc->filename + strlen(dc->filename) -
strlen(GNUNET_FS_DIRECTORY_EXT),
- GNUNET_FS_DIRECTORY_EXT)) ) ) ) ) )
+ if (is_recursive_download (dc))
full_recursive_download (dc);
if (dc->child_head == NULL)
{
@@ -1352,6 +1350,10 @@
dc->options = options;
dc->active = GNUNET_CONTAINER_multihashmap_create (1 + 2 * (length /
DBLOCK_SIZE));
dc->treedepth = GNUNET_FS_compute_depth
(GNUNET_ntohll(dc->uri->data.chk.file_length));
+ if ( (filename == NULL) &&
+ (is_recursive_download (dc) ) )
+ dc->temp_filename = GNUNET_DISK_mktemp ("gnunet-directory-download-tmp");
+
#if DEBUG_DOWNLOAD
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Download tree has depth %u\n",
@@ -1456,6 +1458,14 @@
}
GNUNET_CONTAINER_meta_data_destroy (dc->meta);
GNUNET_FS_uri_destroy (dc->uri);
+ if (NULL != dc->temp_filename)
+ {
+ if (0 != UNLINK (dc->temp_filename))
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
+ "unlink",
+ dc->temp_filename);
+ GNUNET_free (dc->temp_filename);
+ }
GNUNET_free (dc);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r11038 - in gnunet: . src/fs,
gnunet <=