createrepo_c library 0.20.0
C library for metadata manipulation
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
24extern "C" {
25#endif
26
27#include <glib.h>
28#include <rpm/rpmlib.h>
29#include "load_metadata.h"
30#include "locate_metadata.h"
31#include "misc.h"
32#include "package.h"
33#include "sqlite.h"
34#include "xml_file.h"
35
41struct PoolTask {
42 long id; // ID of the task
43 long media_id; // ID of media in split mode, 0 if not in split mode
44 char* full_path; // Complete path - /foo/bar/packages/foo.rpm
45 char* filename; // Just filename - foo.rpm
46 char* path; // Just path - /foo/bar/packages
47};
48
49struct UserData {
50 cr_XmlFile *pri_f; // Opened compressed primary.xml.*
51 cr_XmlFile *fil_f; // Opened compressed filelists.xml.*
52 cr_XmlFile *oth_f; // Opened compressed other.xml.*
53 cr_SqliteDb *pri_db; // Primary db
54 cr_SqliteDb *fil_db; // Filelists db
55 cr_SqliteDb *oth_db; // Other db
56 cr_XmlFile *pri_zck; // Opened compressed primary.xml.zck
57 cr_XmlFile *fil_zck; // Opened compressed filelists.xml.zck
58 cr_XmlFile *oth_zck; // Opened compressed other.xml.zck
59 char *prev_srpm; // Previous srpm
60 char *cur_srpm; // Current srpm
61 int changelog_limit; // Max number of changelogs for a package
62 const char *location_base; // Base location url
63 int repodir_name_len; // Len of path to repo /foo/bar/repodata
64 // This part |<----->|
65 const char *checksum_type_str; // Name of selected checksum
66 cr_ChecksumType checksum_type; // Constant representing selected checksum
67 const char *checksum_cachedir; // Dir with cached checksums
68 gboolean skip_symlinks; // Skip symlinks
69 long task_count; // Total number of task to process
70 long package_count; // Total number of packages processed
71
72 // Update stuff
73 gboolean skip_stat; // Skip stat() while updating
74 cr_Metadata *old_metadata; // Loaded metadata
75 GMutex mutex_old_md; // Mutex for accessing old metadata
76
77 // Thread serialization
78 GMutex mutex_pri; // Mutex for primary metadata
79 GMutex mutex_fil; // Mutex for filelists metadata
80 GMutex mutex_oth; // Mutex for other metadata
81 GCond cond_pri; // Condition for primary metadata
82 GCond cond_fil; // Condition for filelists metadata
83 GCond cond_oth; // Condition for other metadata
84 volatile long id_pri; // ID of task on turn (write primary metadata)
85 volatile long id_fil; // ID of task on turn (write filelists metadata)
86 volatile long id_oth; // ID of task on turn (write other metadata)
87
88 // Buffering
89 GQueue *buffer; // Buffer for done tasks
90 GMutex mutex_buffer; // Mutex for accessing the buffer
91
92 // Delta generation
93 gboolean deltas; // Are deltas enabled?
94 gint64 max_delta_rpm_size; // Max size of an rpm that to run
95 // deltarpm against
96 GMutex mutex_deltatargetpackages; // Mutex
97 GSList *deltatargetpackages; // List of cr_DeltaTargetPackages
98
99 // Location href modifiers
100 gint cut_dirs; // Ignore *num* of directory components
101 // in location href path
102 gchar *location_prefix; // Append this prefix into location_href
103 // during repodata generation
104 gboolean had_errors; // Any errors encountered?
105
106 FILE *output_pkg_list; // File where a list of read packages is written
107 GMutex mutex_output_pkg_list; // Mutex for output_pkg_list file
108};
109
110
111void
112cr_dumper_thread(gpointer data, gpointer user_data);
113
116#ifdef __cplusplus
117}
118#endif
119
120#endif /* __C_CREATEREPOLIB_DUMPER_THREAD_H__ */
cr_ChecksumType
Definition: checksum.h:43
struct _cr_Metadata cr_Metadata
Definition: load_metadata.h:86