From: Christian Grothoff Date: Wed, 2 Sep 2009 20:07:59 +0000 (+0000) Subject: fixing datastore API, improving unindex X-Git-Tag: initial-import-from-subversion-38251~23536 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=eae423bc26419913e447f91a37e48f5ac2f8133f;p=oweals%2Fgnunet.git fixing datastore API, improving unindex --- diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c index 79dd7a318..87ae427e4 100644 --- a/src/datastore/gnunet-service-datastore.c +++ b/src/datastore/gnunet-service-datastore.c @@ -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 */ diff --git a/src/fs/fs_unindex.c b/src/fs/fs_unindex.c index 2d16e9aee..fb72c0167 100644 --- a/src/fs/fs_unindex.c +++ b/src/fs/fs_unindex.c @@ -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. diff --git a/src/include/gnunet_datastore_service.h b/src/include/gnunet_datastore_service.h index acd9af1de..be4931811 100644 --- a/src/include/gnunet_datastore_service.h +++ b/src/include/gnunet_datastore_service.h @@ -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