5 #ifndef CVMFS_GARBAGE_COLLECTION_GC_AUX_IMPL_H_
6 #define CVMFS_GARBAGE_COLLECTION_GC_AUX_IMPL_H_
15 template <
class CatalogTraversalT,
class HashFilterT>
24 template <
class CatalogTraversalT,
class HashFilterT>
27 const HashFilterT &preserved_objects)
29 if (config_.verbose) {
31 "Sweeping auxiliary objects older than %s",
34 std::vector<SqlReflog::ReferenceType> aux_types;
38 for (
unsigned i = 0; i < aux_types.size(); ++i) {
39 std::vector<shash::Any> hashes;
41 config_.reflog->ListOlderThan(aux_types[i], timestamp, &hashes);
44 PrintAuxType(aux_types[i]).c_str());
47 if (config_.verbose) {
49 hashes.size(), PrintAuxType(aux_types[i]).c_str());
52 for (
unsigned iter = 0; iter < hashes.size(); ++iter) {
53 if (preserved_objects.Contains(hashes[iter])) {
54 if (config_.verbose) {
56 hashes[iter].ToStringWithSuffix().c_str());
61 if (!Sweep(hashes[iter]))
66 config_.uploader->WaitForUpload();
67 return config_.uploader->GetNumberOfErrors() == 0;
71 template <
class CatalogTraversalT,
class HashFilterT>
77 return "file catalog";
81 return "tag database";
83 return "repository meta information";
90 template <
class CatalogTraversalT,
class HashFilterT>
94 if (config_.verbose) {
99 if (!config_.dry_run) {
100 config_.uploader->RemoveAsync(hash);
101 bool retval = config_.reflog->Remove(hash);
109 if (config_.has_deletion_log()) {
110 const int written = fprintf(config_.deleted_objects_logfile,
121 #endif // CVMFS_GARBAGE_COLLECTION_GC_AUX_IMPL_H_
std::string PrintAuxType(SqlReflog::ReferenceType type)
GarbageCollectorAux(const ConfigurationTN &config)
std::string ToStringWithSuffix() const
assert((mem||(size==0))&&"Out Of Memory")
string StringifyTime(const time_t seconds, const bool utc)
bool Sweep(const shash::Any &hash)
upload::AbstractUploader * uploader
bool CollectOlderThan(uint64_t timestamp, const HashFilterT &preserved_objects)
const ConfigurationTN config_
CVMFS_EXPORT void LogCvmfs(const LogSource source, const int mask, const char *format,...)