createrepo_c library 1.2.3
C library for metadata manipulation
Loading...
Searching...
No Matches
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 "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
39
40struct PoolTask {
41 long id; // ID of the task
42 long media_id; // ID of media in split mode, 0 if not in split mode
43 char* full_path; // Complete path - /foo/bar/packages/foo.rpm
44 char* filename; // Just filename - foo.rpm
45 char* path; // Just path - /foo/bar/packages
46};
47
49 gchar *location;
50 cr_Package *pkg;
51};
52
53struct UserData {
54 cr_XmlFile *pri_f; // Opened compressed primary.xml.*
55 cr_XmlFile *fil_f; // Opened compressed filelists.xml.*
56 cr_XmlFile *fex_f; // Opened compressed filelists-ext.xml.*
57 cr_XmlFile *oth_f; // Opened compressed other.xml.*
58 cr_SqliteDb *pri_db; // Primary db
59 cr_SqliteDb *fil_db; // Filelists db
60 cr_SqliteDb *fex_db; // Filelists-ext db
61 cr_SqliteDb *oth_db; // Other db
62 cr_XmlFile *pri_zck; // Opened compressed primary.xml.zck
63 cr_XmlFile *fil_zck; // Opened compressed filelists.xml.zck
64 cr_XmlFile *fex_zck; // Opened compressed filelists-ext.xml.zck
65 cr_XmlFile *oth_zck; // Opened compressed other.xml.zck
66 char *prev_srpm; // Previous srpm
67 char *cur_srpm; // Current srpm
68 int changelog_limit; // Max number of changelogs for a package
69 const char *location_base; // Base location url
70 int repodir_name_len; // Len of path to repo /foo/bar/repodata
71 // This part |<----->|
72 const char *checksum_type_str; // Name of selected checksum
73 cr_ChecksumType checksum_type; // Constant representing selected checksum
74 const char *checksum_cachedir; // Dir with cached checksums
75 gboolean skip_symlinks; // Skip symlinks
76 gboolean filelists_ext; // Include hashes (and create filelists-ext.*)
77 long task_count; // Total number of tasks to process
78 long package_count; // Total number of packages processed
79 long skipped_count; // Total number of explicitly skipped packages
80
81 // Duplicate package error checking
82 GMutex mutex_nevra_table; // Mutex for the table of NEVRAs
83 GHashTable *nevra_table; // Table of NEVRAs mapped to packages and their locations
84
85 // Update stuff
86 gboolean skip_stat; // Skip stat() while updating
87 cr_Metadata *old_metadata; // Loaded metadata
88 GMutex mutex_old_md; // Mutex for accessing old metadata
89
90 // Thread serialization
91 GMutex mutex_pri; // Mutex for primary metadata
92 GMutex mutex_fil; // Mutex for filelists metadata
93 GMutex mutex_fex; // Mutex for filelists-ext metadata
94 GMutex mutex_oth; // Mutex for other metadata
95 GCond cond_pri; // Condition for primary metadata
96 GCond cond_fil; // Condition for filelists metadata
97 GCond cond_fex; // Condition for filelists-ext metadata
98 GCond cond_oth; // Condition for other metadata
99 volatile long id_pri; // ID of task on turn (write primary metadata)
100 volatile long id_fil; // ID of task on turn (write filelists metadata)
101 volatile long id_fex; // ID of task on turn (write filelists-ext metadata)
102 volatile long id_oth; // ID of task on turn (write other metadata)
103
104 // Buffering
105 GQueue *buffer; // Buffer for done tasks
106 GMutex mutex_buffer; // Mutex for accessing the buffer
107
108 // Delta generation
109 gboolean deltas; // Are deltas enabled?
110 gint64 max_delta_rpm_size; // Max size of an rpm that to run
111 // deltarpm against
112 GMutex mutex_deltatargetpackages; // Mutex
113 GSList *deltatargetpackages; // List of cr_DeltaTargetPackages
114
115 // Location href modifiers
116 gint cut_dirs; // Ignore *num* of directory components
117 // in location href path
118 gchar *location_prefix; // Append this prefix into location_href
119 // during repodata generation
120 gboolean had_errors; // Any errors encountered?
121
122 FILE *output_pkg_list; // File where a list of read packages is written
123 GMutex mutex_output_pkg_list; // Mutex for output_pkg_list file
124 GArray *delayed_write; // Dump these files once all packages are loaded
125};
126
127
128void
129cr_dumper_thread(gpointer data, gpointer user_data);
130
131
132void
133cr_delayed_dump_set(gpointer user_data);
134
135void
136cr_delayed_dump_run(gpointer user_data);
137
139
140#ifdef __cplusplus
141}
142#endif
143
144#endif /* __C_CREATEREPOLIB_DUMPER_THREAD_H__ */
cr_ChecksumType
Definition checksum.h:43
struct _cr_Metadata cr_Metadata