createrepo_c library  0.10.0
C library for metadata manipulation
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules Pages
dumper_thread.h
1 /* createrepo_c - Library of routines for manipulation with repodata
2  * Copyright (C) 2014 Tomas Mlcoch
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17  * USA.
18  */
19 
20 #ifndef __C_CREATEREPOLIB_DUMPER_THREAD_H__
21 #define __C_CREATEREPOLIB_DUMPER_THREAD_H__
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #include <glib.h>
28 #include "load_metadata.h"
29 #include "locate_metadata.h"
30 #include "misc.h"
31 #include "package.h"
32 #include "sqlite.h"
33 #include "xml_file.h"
34 
40 struct PoolTask {
41  long id; // ID of the task
42  char* full_path; // Complete path - /foo/bar/packages/foo.rpm
43  char* filename; // Just filename - foo.rpm
44  char* path; // Just path - /foo/bar/packages
45 };
46 
47 struct UserData {
48  cr_XmlFile *pri_f; // Opened compressed primary.xml.*
49  cr_XmlFile *fil_f; // Opened compressed filelists.xml.*
50  cr_XmlFile *oth_f; // Opened compressed other.xml.*
51  cr_SqliteDb *pri_db; // Primary db
52  cr_SqliteDb *fil_db; // Filelists db
53  cr_SqliteDb *oth_db; // Other db
54  int changelog_limit; // Max number of changelogs for a package
55  const char *location_base; // Base location url
56  int repodir_name_len; // Len of path to repo /foo/bar/repodata
57  // This part |<----->|
58  const char *checksum_type_str; // Name of selected checksum
59  cr_ChecksumType checksum_type; // Constant representing selected checksum
60  const char *checksum_cachedir; // Dir with cached checksums
61  gboolean skip_symlinks; // Skip symlinks
62  long package_count; // Total number of packages to process
63 
64  // Update stuff
65  gboolean skip_stat; // Skip stat() while updating
66  cr_Metadata *old_metadata; // Loaded metadata
67 
68  // Thread serialization
69  GMutex *mutex_pri; // Mutex for primary metadata
70  GMutex *mutex_fil; // Mutex for filelists metadata
71  GMutex *mutex_oth; // Mutex for other metadata
72  GCond *cond_pri; // Condition for primary metadata
73  GCond *cond_fil; // Condition for filelists metadata
74  GCond *cond_oth; // Condition for other metadata
75  volatile long id_pri; // ID of task on turn (write primary metadata)
76  volatile long id_fil; // ID of task on turn (write filelists metadata)
77  volatile long id_oth; // ID of task on turn (write other metadata)
78 
79  // Buffering
80  GQueue *buffer; // Buffer for done tasks
81  GMutex *mutex_buffer; // Mutex for accessing the buffer
82 
83  // Delta generation
84  gboolean deltas; // Are deltas enabled?
85  gint64 max_delta_rpm_size; // Max size of an rpm that to run
86  // deltarpm against
87  GMutex *mutex_deltatargetpackages; // Mutex
88  GSList *deltatargetpackages; // List of cr_DeltaTargetPackages
89 
90  // Location href modifiers
91  gint cut_dirs; // Ignore *num* of directory components
92  // in location href path
93  gchar *location_prefix; // Append this prefix into location_href
94  // during repodata generation
95 };
96 
97 
98 void
99 cr_dumper_thread(gpointer data, gpointer user_data);
100 
103 #ifdef __cplusplus
104 }
105 #endif
106 
107 #endif /* __C_CREATEREPOLIB_DUMPER_THREAD_H__ */
cr_ChecksumType
Definition: checksum.h:43
struct _cr_Metadata cr_Metadata
Definition: load_metadata.h:85