gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r11145 - gnunet/src/fs


From: gnunet
Subject: [GNUnet-SVN] r11145 - gnunet/src/fs
Date: Sat, 1 May 2010 13:25:18 +0200

Author: grothoff
Date: 2010-05-01 13:25:18 +0200 (Sat, 01 May 2010)
New Revision: 11145

Modified:
   gnunet/src/fs/fs.c
   gnunet/src/fs/fs.h
Log:
search stuff

Modified: gnunet/src/fs/fs.c
===================================================================
--- gnunet/src/fs/fs.c  2010-05-01 11:21:42 UTC (rev 11144)
+++ gnunet/src/fs/fs.c  2010-05-01 11:25:18 UTC (rev 11145)
@@ -1244,6 +1244,60 @@
 
 
 /**
+ * Synchronize this search struct with its mirror
+ * on disk.  Note that all internal FS-operations that change
+ * publishing structs should already call "sync" internally,
+ * so this function is likely not useful for clients.
+ * 
+ * @param sc the struct to sync
+ */
+void
+GNUNET_FS_search_sync_ (struct GNUNET_FS_SearchContext *sc)
+{  
+  struct GNUNET_BIO_WriteHandle *wh;
+
+  if (NULL == sc->serialization)
+    sc->serialization = make_serialization_file_name (sc->h,
+                                                     "search");
+  if (NULL == sc->serialization)
+    return;
+  wh = get_write_handle (sc->h, "search", sc->serialization);
+#if 0
+  if ( (GNUNET_OK !=
+       GNUNET_BIO_write_string (wh, pc->nid)) ||
+       (GNUNET_OK !=
+       GNUNET_BIO_write_string (wh, pc->nuid)) ||
+       (GNUNET_OK !=
+       GNUNET_BIO_write_int32 (wh, pc->options)) ||
+       (GNUNET_OK !=
+       GNUNET_BIO_write_int32 (wh, pc->all_done)) ||
+       (GNUNET_OK !=
+       GNUNET_BIO_write_string (wh, pc->fi->serialization)) ||
+       (GNUNET_OK !=
+       GNUNET_BIO_write_string (wh, (pc->fi_pos == NULL) ? NULL : 
pc->fi_pos->serialization)) ||
+       (GNUNET_OK !=
+       GNUNET_BIO_write_string (wh, (pc->namespace == NULL) ? NULL : 
pc->namespace->name)) )
+   {
+     (void) GNUNET_BIO_write_close (wh);
+     GNUNET_FS_remove_sync_file_ (pc->h, "publish", pc->serialization);
+     GNUNET_free (pc->serialization);
+     pc->serialization = NULL;
+     return;
+   }
+#endif
+  /* FIXME: do search-specific deserialization here! */
+  if (GNUNET_OK !=
+      GNUNET_BIO_write_close (wh))
+    {
+      GNUNET_FS_remove_sync_file_ (sc->h, "search", sc->serialization);
+      GNUNET_free (sc->serialization);
+      sc->serialization = NULL;
+      return;     
+    }  
+}
+
+
+/**
  * Deserialize information about pending publish operations.
  *
  * @param h master context

Modified: gnunet/src/fs/fs.h
===================================================================
--- gnunet/src/fs/fs.h  2010-05-01 11:21:42 UTC (rev 11144)
+++ gnunet/src/fs/fs.h  2010-05-01 11:25:18 UTC (rev 11145)
@@ -758,6 +758,19 @@
 
 
 /**
+ * Synchronize this search struct with its mirror
+ * on disk.  Note that all internal FS-operations that change
+ * publishing structs should already call "sync" internally,
+ * so this function is likely not useful for clients.
+ * 
+ * @param sc the struct to sync
+ */
+void
+GNUNET_FS_search_sync_ (struct GNUNET_FS_SearchContext *sc);
+
+
+
+/**
  * Master context for most FS operations.
  */
 struct GNUNET_FS_Handle
@@ -1223,6 +1236,11 @@
   void *client_info;
 
   /**
+   * Name of the file on disk we use for persistence.
+   */
+  char *serialization;
+
+  /**
    * Map that contains a "struct SearchResult" for each result that
    * was found in the search.  The key for each entry is the XOR of
    * the key and query in the CHK URI (as a unique identifier for the





reply via email to

[Prev in Thread] Current Thread [Next in Thread]