00001 /* createrepo_c - Library of routines for manipulation with repodata 00002 * Copyright (C) 2014 Tomas Mlcoch 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 00017 * USA. 00018 */ 00019 00020 #ifndef __C_CREATEREPOLIB_DUMPER_THREAD_H__ 00021 #define __C_CREATEREPOLIB_DUMPER_THREAD_H__ 00022 00023 #ifdef __cplusplus 00024 extern "C" { 00025 #endif 00026 00027 #include <rpm/rpmlib.h> 00028 #include <glib.h> 00029 #include "load_metadata.h" 00030 #include "locate_metadata.h" 00031 #include "misc.h" 00032 #include "package.h" 00033 #include "sqlite.h" 00034 #include "xml_file.h" 00035 00041 struct PoolTask { 00042 long id; // ID of the task 00043 char* full_path; // Complete path - /foo/bar/packages/foo.rpm 00044 char* filename; // Just filename - foo.rpm 00045 char* path; // Just path - /foo/bar/packages 00046 }; 00047 00048 struct UserData { 00049 GThreadPool *pool; // thread pool 00050 cr_XmlFile *pri_f; // Opened compressed primary.xml.* 00051 cr_XmlFile *fil_f; // Opened compressed filelists.xml.* 00052 cr_XmlFile *oth_f; // Opened compressed other.xml.* 00053 cr_SqliteDb *pri_db; // Primary db 00054 cr_SqliteDb *fil_db; // Filelists db 00055 cr_SqliteDb *oth_db; // Other db 00056 int changelog_limit; // Max number of changelogs for a package 00057 const char *location_base; // Base location url 00058 int repodir_name_len; // Len of path to repo /foo/bar/repodata 00059 // This part |<----->| 00060 const char *checksum_type_str; // Name of selected checksum 00061 cr_ChecksumType checksum_type; // Constant representing selected checksum 00062 const char *checksum_cachedir; // Dir with cached checksums 00063 gboolean skip_symlinks; // Skip symlinks 00064 long package_count; // Total number of packages to process 00065 00066 // Update stuff 00067 gboolean skip_stat; // Skip stat() while updating 00068 cr_Metadata *old_metadata; // Loaded metadata 00069 00070 // Thread serialization 00071 GMutex *mutex_pri; // Mutex for primary metadata 00072 GMutex *mutex_fil; // Mutex for filelists metadata 00073 GMutex *mutex_oth; // Mutex for other metadata 00074 GCond *cond_pri; // Condition for primary metadata 00075 GCond *cond_fil; // Condition for filelists metadata 00076 GCond *cond_oth; // Condition for other metadata 00077 volatile long id_pri; // ID of task on turn (write primary metadata) 00078 volatile long id_fil; // ID of task on turn (write filelists metadata) 00079 volatile long id_oth; // ID of task on turn (write other metadata) 00080 00081 // Buffering 00082 GQueue *buffer; // Buffer for done tasks 00083 GMutex *mutex_buffer; // Mutex for accessing the buffer 00084 }; 00085 00086 00087 void 00088 cr_dumper_thread(gpointer data, gpointer user_data); 00089 00092 #ifdef __cplusplus 00093 } 00094 #endif 00095 00096 #endif /* __C_CREATEREPOLIB_DUMPER_THREAD_H__ */