5 #ifndef CVMFS_CATALOG_COUNTERS_H_
6 #define CVMFS_CATALOG_COUNTERS_H_
8 #include <gtest/gtest_prod.h>
14 namespace swissknife {
21 class CatalogDatabase;
34 template<
typename FieldT>
41 typedef std::map<std::string, const FieldT*>
FieldsMap;
59 void Add(
const U &other) {
68 template<
typename U,
int factor>
79 xattrs += factor * other.xattrs;
86 (*map)[prefix +
"symlink"] = &
symlinks;
87 (*map)[prefix +
"special"] = &
specials;
92 (*map)[prefix +
"file_size"] = &
file_size;
94 (*map)[prefix +
"xattr"] = &
xattrs;
114 FieldT
Get(
const std::string &key)
const;
122 std::map<std::string, FieldT>
GetValues()
const;
166 #endif // CVMFS_CATALOG_COUNTERS_H_
bool InsertIntoDatabase(const CatalogDatabase &database) const
void ApplyDelta(const DeltaCounters &delta)
static DeltaCounters Diff(const Counters &from, const Counters &to)
Counters_t GetSelfEntries() const
std::map< std::string, const DeltaCounters_t * > FieldsMap
void Increment(const DirectoryEntry &dirent)
void AddAsSubtree(DeltaCounters *delta) const
bool WriteToDatabase(const CatalogDatabase &database) const
FieldsMap GetFieldsMap() const
std::map< std::string, FieldT > GetValues() const
void FillFieldsMap(const std::string &prefix, FieldsMap *map) const
FieldT external_file_size
void Combine(const U &other)
void PopulateToParent(DeltaCounters *parent) const
void Decrement(const DirectoryEntry &dirent)
Counters_t GetSubtreeEntries() const
bool ReadFromDatabase(const CatalogDatabase &database, const LegacyMode::Type legacy=LegacyMode::kNoLegacy)
void ApplyDelta(const DirectoryEntry &dirent, const int delta)
void Subtract(const U &other)
FRIEND_TEST(T_CatalogCounters, FieldsCombinations)
FieldT Get(const std::string &key) const
std::string GetCsvMap() const
Counters_t GetAllEntries() const
void MergeIntoParent(DeltaCounters *parent_delta) const
void RemoveFromSubtree(const DeltaCounters &child)