5 #ifndef CVMFS_GARBAGE_COLLECTION_GC_AUX_IMPL_H_
6 #define CVMFS_GARBAGE_COLLECTION_GC_AUX_IMPL_H_
15 template<
class CatalogTraversalT,
class HashFilterT>
23 template<
class CatalogTraversalT,
class HashFilterT>
25 uint64_t timestamp,
const HashFilterT &preserved_objects) {
26 if (config_.verbose) {
28 "Sweeping auxiliary objects older than %s",
31 std::vector<SqlReflog::ReferenceType> aux_types;
35 for (
unsigned i = 0; i < aux_types.size(); ++i) {
36 std::vector<shash::Any> hashes;
37 bool retval = config_.reflog->ListOlderThan(aux_types[i], timestamp,
41 PrintAuxType(aux_types[i]).c_str());
44 if (config_.verbose) {
46 hashes.size(), PrintAuxType(aux_types[i]).c_str());
49 for (
unsigned iter = 0; iter < hashes.size(); ++iter) {
50 if (preserved_objects.Contains(hashes[iter])) {
51 if (config_.verbose) {
53 hashes[iter].ToStringWithSuffix().c_str());
58 if (!Sweep(hashes[iter]))
63 config_.uploader->WaitForUpload();
64 return config_.uploader->GetNumberOfErrors() == 0;
68 template<
class CatalogTraversalT,
class HashFilterT>
73 return "file catalog";
77 return "tag database";
79 return "repository meta information";
86 template<
class CatalogTraversalT,
class HashFilterT>
89 if (config_.verbose) {
94 if (!config_.dry_run) {
95 config_.uploader->RemoveAsync(hash);
96 bool retval = config_.reflog->Remove(hash);
104 if (config_.has_deletion_log()) {
105 const int written = fprintf(config_.deleted_objects_logfile,
"%s\n",
116 #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,...)