fixing datastore API, improving unindex
authorChristian Grothoff <christian@grothoff.org>
Wed, 2 Sep 2009 20:07:59 +0000 (20:07 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 2 Sep 2009 20:07:59 +0000 (20:07 +0000)
src/datastore/gnunet-service-datastore.c
src/fs/fs_unindex.c
src/include/gnunet_datastore_service.h

index 79dd7a318c5b9b0498006ed4677c2151d7d752fe..87ae427e4cb1704f8020d66a50c6520868640492 100644 (file)
@@ -1016,7 +1016,7 @@ remove_callback (void *cls,
       if (GNUNET_YES == rc->found)
        transmit_status (rc->client, GNUNET_OK, NULL);       
       else
-       transmit_status (rc->client, GNUNET_SYSERR, _("Content not found"));            
+       transmit_status (rc->client, GNUNET_NO, _("Content not found"));        
       GNUNET_SERVER_client_drop (rc->client);
       GNUNET_free (rc);
       return GNUNET_OK; /* last item */
index 2d16e9aeea725f388f7e2576db6a484e754077ce..fb72c01675193608eb186ce52d57d05f05d841dd 100644 (file)
@@ -78,26 +78,6 @@ unindex_reader (void *cls,
 }
 
 
-/**
- * Continuation called to notify client about result of the
- * datastore removal operation.
- *
- * @param cls closure
- * @param success GNUNET_SYSERR on failure
- * @param msg NULL on success, otherwise an error message
- */
-static void
-process_cont (void *cls,
-             int success,
-             const char *msg)
-{
-  struct GNUNET_FS_UnindexContext *uc = cls;
-  // FIXME: may want to check for errors
-  // OTHER than content-not-present!
-  GNUNET_FS_tree_encoder_next (uc->tc);
-}
-
-
 /**
  * Function called asking for the current (encoded)
  * block to be processed.  After processing the
@@ -226,6 +206,31 @@ signal_unindex_error (struct GNUNET_FS_UnindexContext *uc,
 }
 
 
+/**
+ * Continuation called to notify client about result of the
+ * datastore removal operation.
+ *
+ * @param cls closure
+ * @param success GNUNET_SYSERR on failure
+ * @param msg NULL on success, otherwise an error message
+ */
+static void
+process_cont (void *cls,
+             int success,
+             const char *msg)
+{
+  struct GNUNET_FS_UnindexContext *uc = cls;
+  if (success == GNUNET_SYSERR)
+    {
+      signal_unindex_error (uc,
+                           emsg);
+      return;
+    }
+  
+  GNUNET_FS_tree_encoder_next (uc->tc);
+}
+
+
 /**
  * Function called when the tree encoder has
  * processed all blocks.  Clean up.
index acd9af1dedfd6de0b75492cf0f34ff174e5821c8..be4931811e65e311920df03c65cf9fa7946bf5e6 100644 (file)
@@ -254,6 +254,10 @@ GNUNET_DATASTORE_get_random (struct GNUNET_DATASTORE_Handle *h,
 
 /**
  * Explicitly remove some content from the database.
+ * The "cont"inuation will be called with status
+ * "GNUNET_OK" if content was removed, "GNUNET_NO"
+ * if no matching entry was found and "GNUNET_SYSERR"
+ * on all other types of errors.
  *
  * @param h handle to the datastore
  * @param key key for the value