#include "error.h"
#include "misc.h"
-/** Compression */
+/** Parallel Compression */
cr_CompressionTask *
cr_compressiontask_new(const char *src,
remove(task->src);
}
}
+
+/** Parallel Repomd Record Fill */
+
+cr_RepomdRecordFillTask *
+cr_repomdrecordfilltask_new(cr_RepomdRecord *record,
+ cr_ChecksumType checksum_type,
+ GError **err)
+{
+ cr_RepomdRecordFillTask *task;
+
+ assert(record);
+ assert(!err || *err == NULL);
+
+ task = g_malloc0(sizeof(cr_RepomdRecord));
+ task->record = record;
+ task->checksum_type = checksum_type;
+
+ return task;
+}
+
+void
+cr_repomdrecordfilltask_free(cr_RepomdRecordFillTask *task,
+ GError **err)
+{
+ assert(!err || *err == NULL);
+
+ if (task->err)
+ g_error_free(task->err);
+ g_free(task);
+}
+
+void
+cr_repomd_record_fill_thread(gpointer data, gpointer user_data)
+{
+ cr_RepomdRecordFillTask *task = data;
+ GError *tmp_err = NULL;
+
+ CR_UNUSED(user_data);
+
+ assert(task);
+
+ cr_repomd_record_fill(task->record, task->checksum_type, &tmp_err);
+
+ if (tmp_err) {
+ // Error encountered
+ g_propagate_error(&task->err, tmp_err);
+ }
+}
#include <glib.h>
#include "compression_wrapper.h"
#include "checksum.h"
+#include "repomd.h"
#ifdef __cplusplus
extern "C" {
* cr_compresiontask_new function. The GError
* that will be at created cr_CompressionTask is
* different.
+ * @return New cr_CompressionTask.
*/
cr_CompressionTask *
cr_compressiontask_new(const char *src,
/** Frees cr_CompressionTask and all its components.
* @param task cr_CompressionTask task
- * @param err GError **.
+ * @param err GError **
*/
void
cr_compressiontask_free(cr_CompressionTask *task, GError **err);
void
cr_compressing_thread(gpointer data, gpointer user_data);
+/** Repomd record fill */
+
+typedef struct {
+ cr_RepomdRecord *record;
+ cr_ChecksumType checksum_type;
+ GError *err;
+} cr_RepomdRecordFillTask;
+
+/** Function to prepare a new cr_RepomdRecordFillTask.
+ * @param record cr_RepomdRecord.
+ * @param checksum_type Type of checksum.
+ * @param err GError **
+ * @return New cr_RepomdRecordFillTask.
+ */
+cr_RepomdRecordFillTask *
+cr_repomdrecordfilltask_new(cr_RepomdRecord *record,
+ cr_ChecksumType checksum_type,
+ GError **err);
+
+/** Frees cr_RepomdRecordFillTask
+ */
+void
+cr_repomdrecordfilltask_free(cr_RepomdRecordFillTask *task, GError **err);
+
+/** Function for GThread Pool.
+ */
+void
+cr_repomd_record_fill_thread(gpointer data, gpointer user_data);
+
/** @} */
#ifdef __cplusplus