From 02f5d87d763fd185fcc27c5911346e951b11e2e3 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 1 May 2010 11:21:42 +0000 Subject: [PATCH] todo update --- TODO | 6 ++++-- src/fs/fs.c | 53 ++++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 48 insertions(+), 11 deletions(-) diff --git a/TODO b/TODO index 0b24b0347..5d9a03b75 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,9 @@ 0.9.0pre1: * FS: [CG] - - persistence support (unindex, search, download) - - persistence testing (publish) + - serialization and deserialization code (search, download) + - generate SUSPEND events (publish, unindex, search, download) + - actually call 'sync' functions (publish, unindex, search, download) + - persistence testing (publish, unindex) - 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 diff --git a/src/fs/fs.c b/src/fs/fs.c index c0271282a..84985855b 100644 --- a/src/fs/fs.c +++ b/src/fs/fs.c @@ -1403,6 +1403,46 @@ deserialize_unindex (struct GNUNET_FS_Handle *h) } + +/** + * Function called with a filename of serialized search operation + * to deserialize. + * + * @param cls the 'struct GNUNET_FS_Handle*' + * @param filename complete filename (absolute path) + * @return GNUNET_OK (continue to iterate) + */ +static int +deserialize_search_file (void *cls, + const char *filename) +{ + /* FIXME */ + // Deserialize Search: + // * for each query, read file with search results + // * for each search result with active download, deserialize download + // * for each directory search result, check for active downloads of contents + return GNUNET_OK; +} + + +/** + * Deserialize information about pending search operations. + * + * @param h master context + */ +static void +deserialize_search (struct GNUNET_FS_Handle *h) +{ + char *dn; + + dn = get_serialization_file_name (h, "search", ""); + if (dn == NULL) + return; + GNUNET_DISK_directory_scan (dn, &deserialize_search_file, h); + GNUNET_free (dn); +} + + /** * Setup a connection to the file-sharing service. * @@ -1466,18 +1506,13 @@ GNUNET_FS_start (struct GNUNET_SCHEDULER_Handle *sched, } va_end (ap); // FIXME: setup receive-loop with client (do we need one?) - if (0 != (GNUNET_FS_FLAGS_PERSISTENCE & flags)) { + /* FIXME: could write one generic deserialization + function instead of these four... */ deserialize_publish (ret); - /* FIXME: not implemented! */ - // Deserialize Search: - // * read search queries - // * for each query, read file with search results - // * for each search result with active download, deserialize download - // * for each directory search result, check for active downloads of contents - // Deserialize Download: - // * always part of search??? + deserialize_search (ret); + /* FIXME: deserialize downloads that are NOT part of searches */ deserialize_unindex (ret); } return ret; -- 2.25.1