| Directory: | cvmfs/ |
|---|---|
| File: | cvmfs/repository_tag.h |
| Date: | 2026-06-28 02:36:10 |
| Exec | Total | Coverage | |
|---|---|---|---|
| Lines: | 16 | 16 | 100.0% |
| Branches: | 3 | 6 | 50.0% |
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /** | ||
| 2 | * This file is part of the CernVM File System. | ||
| 3 | */ | ||
| 4 | |||
| 5 | #ifndef CVMFS_REPOSITORY_TAG_H_ | ||
| 6 | #define CVMFS_REPOSITORY_TAG_H_ | ||
| 7 | |||
| 8 | #include <ctime> | ||
| 9 | #include <string> | ||
| 10 | |||
| 11 | class RepositoryTag { | ||
| 12 | public: | ||
| 13 | 838 | RepositoryTag() | |
| 14 |
3/6✓ Branch 2 taken 838 times.
✗ Branch 3 not taken.
✓ Branch 7 taken 838 times.
✗ Branch 8 not taken.
✓ Branch 12 taken 838 times.
✗ Branch 13 not taken.
|
838 | : name_(""), description_(""), delete_tags_(""), auto_tag_threshold_(0) { } |
| 15 | RepositoryTag(const std::string &name, const std::string &description); | ||
| 16 | |||
| 17 | 2 | void SetName(const std::string &name) { name_ = name; } | |
| 18 | 1 | void SetDescription(const std::string &description) { | |
| 19 | 1 | description_ = description; | |
| 20 | 1 | } | |
| 21 | // Space-separated list of existing tag names to remove on commit (empty | ||
| 22 | // disables removal). Used by `cvmfs_server tag -r` on gateway repositories, | ||
| 23 | // where the publisher cannot edit the tag database directly, so the receiver | ||
| 24 | // performs the removal in the same history transaction as the commit. | ||
| 25 | 10 | void SetDeleteTags(const std::string &delete_tags) { | |
| 26 | 10 | delete_tags_ = delete_tags; | |
| 27 | 10 | } | |
| 28 | // Unix timestamp: auto-generated tags older than this are removed on commit. | ||
| 29 | // 0 disables the cleanup. The publisher resolves CVMFS_AUTO_TAG_TIMESPAN to | ||
| 30 | // an absolute timestamp before sending it to the gateway, so no human-readable | ||
| 31 | // date string ever needs to be parsed on the (untrusted) receiver side. | ||
| 32 | 4 | void SetAutoTagThreshold(time_t threshold) { | |
| 33 | 4 | auto_tag_threshold_ = threshold; | |
| 34 | 4 | } | |
| 35 | |||
| 36 | bool HasGenericName(); | ||
| 37 | void SetGenericName(); | ||
| 38 | |||
| 39 | // True if `name` is a full auto-generated tag name, i.e. "generic-<ISO8601>" | ||
| 40 | // or "generic_<n>-<ISO8601>" (e.g. "generic-2024-01-01T00:00:00.000Z"). | ||
| 41 | // Unlike HasGenericName(), this also requires the timestamp shape, so it does | ||
| 42 | // not match user tags such as "generic-release". Used to decide which tags | ||
| 43 | // the auto-tag cleanup is allowed to delete. | ||
| 44 | static bool IsAutoGeneratedName(const std::string &name); | ||
| 45 | |||
| 46 | 5 | std::string name() const { return name_; } | |
| 47 | 3 | std::string description() const { return description_; } | |
| 48 | 12 | std::string delete_tags() const { return delete_tags_; } | |
| 49 | 8 | time_t auto_tag_threshold() const { return auto_tag_threshold_; } | |
| 50 | |||
| 51 | private: | ||
| 52 | std::string name_; | ||
| 53 | std::string description_; | ||
| 54 | std::string delete_tags_; | ||
| 55 | time_t auto_tag_threshold_; | ||
| 56 | }; | ||
| 57 | |||
| 58 | #endif // CVMFS_REPOSITORY_TAG_H_ | ||
| 59 |