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