libzypp
11.13.5
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
libzypp
Welcome to libzypp
Code Pitfalls - Frequently made mistakes
Code Snippets
Environment Variables
Testing for provided features.
Notes on revisions
Extending ZYpp: Plugins and Hooks
Services
Solver - Vendor protection
Writing and tunning testcases
Libzypp and threads
Todo List
Deprecated List
Modules
Namespaces
Classes
Files
File List
zypp
base
media
misc
parser
pool
repo
sat
solver
target
thread
ui
url
ws
zypp_detail
APIConfig.h
Arch.cc
Arch.h
AutoDispose.h
Bit.h
ByteCount.cc
ByteCount.h
Callback.h
Capabilities.cc
Capabilities.h
Capability.cc
Capability.h
CapMatch.cc
CapMatch.h
Changelog.cc
Changelog.h
CheckSum.cc
CheckSum.h
CountryCode.cc
CountryCode.h
Date.cc
Date.h
Dep.cc
Dep.h
Digest.cc
Digest.h
DiskUsage.cc
DiskUsage.h
DiskUsageCounter.cc
DiskUsageCounter.h
DownloadMode.cc
DownloadMode.h
Edition.cc
Edition.h
ExternalProgram.cc
ExternalProgram.h
Fetcher.cc
Fetcher.h
FileChecker.cc
FileChecker.h
Filter.h
Glob.cc
Glob.h
HistoryLog.cc
HistoryLog.h
HistoryLogData.cc
HistoryLogData.h
IdString.cc
IdString.h
IdStringType.h
InstanceId.cc
InstanceId.h
KeyContext.h
KeyRing.cc
KeyRing.h
KVMap.h
LanguageCode.cc
LanguageCode.h
Locale.cc
Locale.h
Locks.cc
Locks.h
ManagedFile.h
MediaProducts.cc
MediaProducts.h
MediaSetAccess.cc
MediaSetAccess.h
Misc.h
OnMediaLocation.cc
OnMediaLocation.h
Package.cc
Package.h
PackageKeyword.h
Patch.cc
Patch.h
PathInfo.cc
PathInfo.h
Pathname.cc
Pathname.h
Pattern.cc
Pattern.h
PluginFrame.cc
PluginFrame.h
PluginFrameException.cc
PluginFrameException.h
PluginScript.cc
PluginScript.h
PluginScriptException.cc
PluginScriptException.h
PoolItem.cc
PoolItem.h
PoolItemBest.cc
PoolItemBest.h
PoolQuery.cc
PoolQuery.h
PoolQueryResult.cc
PoolQueryResult.h
PoolQueryUtil.tcc
ProblemSolution.cc
ProblemSolution.h
ProblemTypes.h
Product.cc
Product.h
ProgressData.cc
ProgressData.h
ProvideFilePolicy.cc
ProvideFilePolicy.h
PublicKey.cc
PublicKey.h
Range.cc
Range.h
Rel.cc
Rel.h
RelCompare.h
RepoInfo.cc
RepoInfo.h
RepoManager.cc
RepoManager.h
Repository.cc
Repository.h
RepoStatus.cc
RepoStatus.h
ResFilters.h
ResKind.cc
ResKind.h
ResObject.cc
ResObject.h
ResObjects.h
Resolvable.cc
Resolvable.h
Resolver.cc
Resolver.h
ResolverProblem.cc
ResolverProblem.h
ResPool.cc
ResPool.h
ResPoolProxy.cc
ResPoolProxy.h
ResStatus.cc
ResStatus.h
ResTraits.h
ServiceInfo.cc
ServiceInfo.h
Signature.cc
Signature.h
SrcPackage.cc
SrcPackage.h
SysContent.cc
SysContent.h
Target.cc
Target.h
TmpPath.cc
TmpPath.h
TriBool.h
Url.cc
Url.h
Vendor.h
VendorAttr.cc
VendorAttr.h
VendorSupportOptions.cc
VendorSupportOptions.h
ZConfig.cc
ZConfig.h
ZYpp.cc
ZYpp.h
ZYppCallbacks.h
ZYppCommit.h
ZYppCommitPolicy.cc
ZYppCommitPolicy.h
ZYppCommitResult.cc
ZYppCommitResult.h
ZYppFactory.cc
ZYppFactory.h
File Members
ZYppCallbacks.h
Go to the documentation of this file.
1
/*---------------------------------------------------------------------\
2
| ____ _ __ __ ___ |
3
| |__ / \ / / . \ . \ |
4
| / / \ V /| _/ _/ |
5
| / /__ | | | | | | |
6
| /_____||_| |_| |_| |
7
| |
8
\---------------------------------------------------------------------*/
12
#ifndef ZYPP_ZYPPCALLBACKS_H
13
#define ZYPP_ZYPPCALLBACKS_H
14
15
#include "
zypp/Callback.h
"
16
#include "
zypp/Resolvable.h
"
17
#include "
zypp/RepoInfo.h
"
18
#include "
zypp/Pathname.h
"
19
#include "
zypp/Package.h
"
20
#include "
zypp/Patch.h
"
21
#include "
zypp/Url.h
"
22
#include "
zypp/ProgressData.h
"
23
#include "
zypp/media/MediaUserAuth.h
"
24
26
namespace
zypp
27
{
28
29
struct
ProgressReport
:
public
callback::ReportBase
30
{
31
virtual
void
start
(
const
ProgressData
&
/*task*/
)
32
{}
33
34
virtual
bool
progress
(
const
ProgressData
&
/*task*/
)
35
{
return
true
; }
36
37
// virtual Action problem(
38
// Repo /*source*/
39
// , Error /*error*/
40
// , const std::string &/*description*/ )
41
// { return ABORT; }
42
43
virtual
void
finish
(
const
ProgressData
&
/*task*/
)
44
{}
45
46
};
47
48
struct
ProgressReportAdaptor
49
{
50
51
ProgressReportAdaptor
(
const
ProgressData::ReceiverFnc
&fnc,
52
callback::SendReport<ProgressReport>
&
report
)
53
:
_fnc
(fnc)
54
,
_report
(report)
55
,
_first
(true)
56
{
57
}
58
59
bool
operator()
(
const
ProgressData
&progress )
60
{
61
if
(
_first
)
62
{
63
_report
->start(progress);
64
_first
=
false
;
65
}
66
67
_report
->progress(progress);
68
bool
value =
true
;
69
if
(
_fnc
)
70
value =
_fnc
(progress);
71
72
73
if
( progress.
finalReport
() )
74
{
75
_report
->finish(progress);
76
}
77
return
value;
78
}
79
80
ProgressData::ReceiverFnc
_fnc
;
81
callback::SendReport<ProgressReport>
&
_report
;
82
bool
_first
;
83
};
84
86
87
namespace
repo
88
{
89
// progress for downloading a resolvable
90
struct
DownloadResolvableReport
:
public
callback::ReportBase
91
{
92
enum
Action
{
93
ABORT
,
// abort and return error
94
RETRY
,
// retry
95
IGNORE
,
// ignore this resolvable but continue
96
};
97
98
enum
Error
{
99
NO_ERROR
,
100
NOT_FOUND
,
// the requested Url was not found
101
IO
,
// IO error
102
INVALID
// the downloaded file is invalid
103
};
104
105
virtual
void
start
(
106
Resolvable::constPtr
/*resolvable_ptr*/
107
,
const
Url
&
/*url*/
108
) {}
109
110
111
// Dowmload delta rpm:
112
// - path below url reported on start()
113
// - expected download size (0 if unknown)
114
// - download is interruptable
115
// - problems are just informal
116
virtual
void
startDeltaDownload
(
const
Pathname &
/*filename*/
,
const
ByteCount
&
/*downloadsize*/
)
117
{}
118
119
virtual
bool
progressDeltaDownload
(
int
/*value*/
)
120
{
return
true
; }
121
122
virtual
void
problemDeltaDownload
(
const
std::string &
/*description*/
)
123
{}
124
125
virtual
void
finishDeltaDownload
()
126
{}
127
128
// Apply delta rpm:
129
// - local path of downloaded delta
130
// - aplpy is not interruptable
131
// - problems are just informal
132
virtual
void
startDeltaApply
(
const
Pathname &
/*filename*/
)
133
{}
134
135
virtual
void
progressDeltaApply
(
int
/*value*/
)
136
{}
137
138
virtual
void
problemDeltaApply
(
const
std::string &
/*description*/
)
139
{}
140
141
virtual
void
finishDeltaApply
()
142
{}
143
144
// Dowmload patch rpm:
145
// - path below url reported on start()
146
// - expected download size (0 if unknown)
147
// - download is interruptable
148
virtual
void
startPatchDownload
(
const
Pathname &
/*filename*/
,
const
ByteCount
&
/*downloadsize*/
)
149
{}
150
151
virtual
bool
progressPatchDownload
(
int
/*value*/
)
152
{
return
true
; }
153
154
virtual
void
problemPatchDownload
(
const
std::string &
/*description*/
)
155
{}
156
157
virtual
void
finishPatchDownload
()
158
{}
159
160
161
// return false if the download should be aborted right now
162
virtual
bool
progress
(
int
/*value*/
,
Resolvable::constPtr
/*resolvable_ptr*/
)
163
{
return
true
; }
164
165
virtual
Action
problem
(
166
Resolvable::constPtr
/*resolvable_ptr*/
167
,
Error
/*error*/
168
,
const
std::string &
/*description*/
169
) {
return
ABORT
; }
170
171
virtual
void
finish
(
Resolvable::constPtr
/*resolvable_ptr*/
172
,
Error
/*error*/
173
,
const
std::string &
/*reason*/
174
) {}
175
};
176
177
// progress for probing a source
178
struct
ProbeRepoReport
:
public
callback::ReportBase
179
{
180
enum
Action
{
181
ABORT
,
// abort and return error
182
RETRY
// retry
183
};
184
185
enum
Error
{
186
NO_ERROR
,
187
NOT_FOUND
,
// the requested Url was not found
188
IO
,
// IO error
189
INVALID
,
// th source is invalid
190
UNKNOWN
191
};
192
193
virtual
void
start
(
const
Url
&
/*url*/
) {}
194
virtual
void
failedProbe
(
const
Url
&
/*url*/
,
const
std::string &
/*type*/
) {}
195
virtual
void
successProbe
(
const
Url
&
/*url*/
,
const
std::string &
/*type*/
) {}
196
virtual
void
finish
(
const
Url
&
/*url*/
,
Error
/*error*/
,
const
std::string &
/*reason*/
) {}
197
198
virtual
bool
progress
(
const
Url
&
/*url*/
,
int
/*value*/
)
199
{
return
true
; }
200
201
virtual
Action
problem
(
const
Url
&
/*url*/
,
Error
/*error*/
,
const
std::string &
/*description*/
) {
return
ABORT
; }
202
};
203
204
struct
RepoCreateReport
:
public
callback::ReportBase
205
{
206
enum
Action
{
207
ABORT
,
// abort and return error
208
RETRY
,
// retry
209
IGNORE
// skip refresh, ignore failed refresh
210
};
211
212
enum
Error
{
213
NO_ERROR
,
214
NOT_FOUND
,
// the requested Url was not found
215
IO
,
// IO error
216
REJECTED
,
217
INVALID
,
// th source is invali
218
UNKNOWN
219
};
220
221
virtual
void
start
(
const
zypp::Url
&
/*url*/
) {}
222
virtual
bool
progress
(
int
/*value*/
)
223
{
return
true
; }
224
225
virtual
Action
problem
(
226
const
zypp::Url
&
/*url*/
227
,
Error
/*error*/
228
,
const
std::string &
/*description*/
)
229
{
return
ABORT
; }
230
231
virtual
void
finish
(
232
const
zypp::Url
&
/*url*/
233
,
Error
/*error*/
234
,
const
std::string &
/*reason*/
)
235
{}
236
};
237
238
struct
RepoReport
:
public
callback::ReportBase
239
{
240
enum
Action
{
241
ABORT
,
// abort and return error
242
RETRY
,
// retry
243
IGNORE
// skip refresh, ignore failed refresh
244
};
245
246
enum
Error
{
247
NO_ERROR
,
248
NOT_FOUND
,
// the requested Url was not found
249
IO
,
// IO error
250
INVALID
// th source is invalid
251
};
252
253
virtual
void
start
(
const
ProgressData
&
/*task*/
,
const
RepoInfo
/*repo*/
) {}
254
virtual
bool
progress
(
const
ProgressData
&
/*task*/
)
255
{
return
true
; }
256
257
virtual
Action
problem
(
258
Repository
/*source*/
259
,
Error
/*error*/
260
,
const
std::string &
/*description*/
)
261
{
return
ABORT
; }
262
263
virtual
void
finish
(
264
Repository
/*source*/
265
,
const
std::string &
/*task*/
266
,
Error
/*error*/
267
,
const
std::string &
/*reason*/
)
268
{}
269
};
270
271
273
}
// namespace source
275
277
namespace
media
278
{
279
// media change request callback
280
struct
MediaChangeReport
:
public
callback::ReportBase
281
{
282
enum
Action
{
283
ABORT
,
// abort and return error
284
RETRY
,
// retry
285
IGNORE
,
// ignore this media in future, not available anymore
286
IGNORE_ID
,
// ignore wrong medium id
287
CHANGE_URL
,
// change media URL
288
EJECT
// eject the medium
289
};
290
291
enum
Error
{
292
NO_ERROR
,
293
NOT_FOUND
,
// the medie not found at all
294
IO
,
// error accessing the media
295
INVALID
,
// media is broken
296
WRONG
,
// wrong media, need a different one
297
IO_SOFT
298
};
299
313
virtual
Action
requestMedia
(
314
Url
&
/* url (I/O parameter) */
315
,
unsigned
/*mediumNr*/
316
,
const
std::string &
/* label */
317
,
Error
/*error*/
318
,
const
std::string &
/*description*/
319
,
const
std::vector<std::string> &
/* devices */
320
,
unsigned
int
&
/* dev_current (I/O param) */
321
) {
return
ABORT
; }
322
};
323
324
// progress for downloading a file
325
struct
DownloadProgressReport
:
public
callback::ReportBase
326
{
327
enum
Action
{
328
ABORT
,
// abort and return error
329
RETRY
,
// retry
330
IGNORE
// ignore the failure
331
};
332
333
enum
Error
{
334
NO_ERROR
,
335
NOT_FOUND
,
// the requested Url was not found
336
IO
,
// IO error
337
ACCESS_DENIED
,
// user authent. failed while accessing restricted file
338
ERROR
// other error
339
};
340
341
virtual
void
start
(
const
Url
&
/*file*/
, Pathname
/*localfile*/
) {}
342
351
virtual
bool
progress
(
int
/*value*/
,
const
Url
&
/*file*/
,
352
double
dbps_avg = -1,
353
double
dbps_current = -1)
354
{
return
true
; }
355
356
virtual
Action
problem
(
357
const
Url
&
/*file*/
358
,
Error
/*error*/
359
,
const
std::string &
/*description*/
360
) {
return
ABORT
; }
361
362
virtual
void
finish
(
363
const
Url
&
/*file*/
364
,
Error
/*error*/
365
,
const
std::string &
/*reason*/
366
) {}
367
};
368
369
// authentication issues report
370
struct
AuthenticationReport
:
public
callback::ReportBase
371
{
386
virtual
bool
prompt
(
const
Url
&
/* url */
,
387
const
std::string &
/* msg */
,
388
AuthData
&
/* auth_data */
)
389
{
390
return
false
;
391
}
392
};
393
395
}
// namespace media
397
399
namespace
target
400
{
402
struct
PatchMessageReport
:
public
callback::ReportBase
403
{
407
virtual
bool
show
(
Patch::constPtr
&
/*patch*/
)
408
{
return
true
; }
409
};
410
415
struct
PatchScriptReport
:
public
callback::ReportBase
416
{
417
enum
Notify
{
OUTPUT
,
PING
};
418
enum
Action
{
419
ABORT
,
// abort commit and return error
420
RETRY
,
// (re)try to execute this script
421
IGNORE
// ignore any failue and continue
422
};
423
426
virtual
void
start
(
const
Package::constPtr
&
/*package*/
,
427
const
Pathname &
/*script path*/
)
428
{}
433
virtual
bool
progress
(
Notify
/*OUTPUT or PING*/
,
434
const
std::string &
/*output*/
= std::string() )
435
{
return
true
; }
437
virtual
Action
problem
(
const
std::string &
/*description*/
)
438
{
return
ABORT
; }
440
virtual
void
finish
()
441
{}
442
};
443
445
namespace
rpm
446
{
447
448
// progress for installing a resolvable
449
struct
InstallResolvableReport
:
public
callback::ReportBase
450
{
451
enum
Action
{
452
ABORT
,
// abort and return error
453
RETRY
,
// retry
454
IGNORE
// ignore the failure
455
};
456
457
enum
Error
{
458
NO_ERROR
,
459
NOT_FOUND
,
// the requested Url was not found
460
IO
,
// IO error
461
INVALID
// th resolvable is invalid
462
};
463
464
// the level of RPM pushing
466
enum
RpmLevel
{
467
RPM
,
468
RPM_NODEPS
,
469
RPM_NODEPS_FORCE
470
};
471
472
virtual
void
start
(
473
Resolvable::constPtr
/*resolvable*/
474
) {}
475
476
virtual
bool
progress
(
int
/*value*/
,
Resolvable::constPtr
/*resolvable*/
)
477
{
return
true
; }
478
479
virtual
Action
problem
(
480
Resolvable::constPtr
/*resolvable*/
481
,
Error
/*error*/
482
,
const
std::string &
/*description*/
483
,
RpmLevel
/*level*/
484
) {
return
ABORT
; }
485
486
virtual
void
finish
(
487
Resolvable::constPtr
/*resolvable*/
488
,
Error
/*error*/
489
,
const
std::string &
/*reason*/
490
,
RpmLevel
/*level*/
491
) {}
492
};
493
494
// progress for removing a resolvable
495
struct
RemoveResolvableReport
:
public
callback::ReportBase
496
{
497
enum
Action
{
498
ABORT
,
// abort and return error
499
RETRY
,
// retry
500
IGNORE
// ignore the failure
501
};
502
503
enum
Error
{
504
NO_ERROR
,
505
NOT_FOUND
,
// the requested Url was not found
506
IO
,
// IO error
507
INVALID
// th resolvable is invalid
508
};
509
510
virtual
void
start
(
511
Resolvable::constPtr
/*resolvable*/
512
) {}
513
514
virtual
bool
progress
(
int
/*value*/
,
Resolvable::constPtr
/*resolvable*/
)
515
{
return
true
; }
516
517
virtual
Action
problem
(
518
Resolvable::constPtr
/*resolvable*/
519
,
Error
/*error*/
520
,
const
std::string &
/*description*/
521
) {
return
ABORT
; }
522
523
virtual
void
finish
(
524
Resolvable::constPtr
/*resolvable*/
525
,
Error
/*error*/
526
,
const
std::string &
/*reason*/
527
) {}
528
};
529
530
// progress for rebuilding the database
531
struct
RebuildDBReport
:
public
callback::ReportBase
532
{
533
enum
Action
{
534
ABORT
,
// abort and return error
535
RETRY
,
// retry
536
IGNORE
// ignore the failure
537
};
538
539
enum
Error
{
540
NO_ERROR
,
541
FAILED
// failed to rebuild
542
};
543
544
virtual
void
start
(Pathname
/*path*/
) {}
545
546
virtual
bool
progress
(
int
/*value*/
, Pathname
/*path*/
)
547
{
return
true
; }
548
549
virtual
Action
problem
(
550
Pathname
/*path*/
551
,
Error
/*error*/
552
,
const
std::string &
/*description*/
553
) {
return
ABORT
; }
554
555
virtual
void
finish
(
556
Pathname
/*path*/
557
,
Error
/*error*/
558
,
const
std::string &
/*reason*/
559
) {}
560
};
561
562
// progress for converting the database
563
struct
ConvertDBReport
:
public
callback::ReportBase
564
{
565
enum
Action
{
566
ABORT
,
// abort and return error
567
RETRY
,
// retry
568
IGNORE
// ignore the failure
569
};
570
571
enum
Error
{
572
NO_ERROR
,
573
FAILED
// conversion failed
574
};
575
576
virtual
void
start
(
577
Pathname
/*path*/
578
) {}
579
580
virtual
bool
progress
(
int
/*value*/
, Pathname
/*path*/
)
581
{
return
true
; }
582
583
virtual
Action
problem
(
584
Pathname
/*path*/
585
,
Error
/*error*/
586
,
const
std::string &
/*description*/
587
) {
return
ABORT
; }
588
589
virtual
void
finish
(
590
Pathname
/*path*/
591
,
Error
/*error*/
592
,
const
std::string &
/*reason*/
593
) {}
594
};
595
597
}
// namespace rpm
599
601
}
// namespace target
603
604
class
PoolQuery;
605
612
struct
CleanEmptyLocksReport
:
public
callback::ReportBase
613
{
617
enum
Action
{
618
ABORT
,
619
DELETE
,
620
IGNORE
621
};
622
626
enum
Error
{
627
NO_ERROR
,
628
ABORTED
629
};
630
634
virtual
void
start
(
635
) {}
636
641
virtual
bool
progress
(
int
/*value*/
)
642
{
return
true
; }
643
648
virtual
Action
execute
(
649
const
PoolQuery
&
/*error*/
650
) {
return
DELETE
; }
651
655
virtual
void
finish
(
656
Error
/*error*/
657
) {}
658
659
};
660
664
struct
SavingLocksReport
:
public
callback::ReportBase
665
{
670
enum
Action
{
671
ABORT
,
672
DELETE
,
673
IGNORE
674
};
675
679
enum
Error
{
680
NO_ERROR
,
681
ABORTED
682
};
683
687
enum
ConflictState
{
688
SAME_RESULTS
,
689
INTERSECT
691
};
692
693
virtual
void
start
() {}
694
699
virtual
bool
progress
()
700
{
return
true
; }
701
705
virtual
Action
conflict
(
706
const
PoolQuery
&,
707
ConflictState
708
) {
return
DELETE
; }
709
710
virtual
void
finish
(
711
Error
/*error*/
712
) {}
713
};
714
715
717
}
// namespace zypp
719
720
#endif // ZYPP_ZYPPCALLBACKS_H
zypp
ZYppCallbacks.h
Generated by
1.8.1