CernVM-FS
2.12.0
|
#include <reflog.h>
Public Member Functions | |
bool | AddCertificate (const shash::Any &certificate) |
bool | AddCatalog (const shash::Any &catalog) |
bool | AddHistory (const shash::Any &history) |
bool | AddMetainfo (const shash::Any &metainfo) |
uint64_t | CountEntries () |
bool | List (SqlReflog::ReferenceType type, std::vector< shash::Any > *hashes) const |
bool | ListOlderThan (SqlReflog::ReferenceType type, uint64_t timestamp, std::vector< shash::Any > *hashes) const |
bool | Remove (const shash::Any &hash) |
bool | ContainsCertificate (const shash::Any &certificate) const |
bool | ContainsCatalog (const shash::Any &catalog) const |
bool | ContainsHistory (const shash::Any &history) const |
bool | ContainsMetainfo (const shash::Any &metainfo) const |
bool | GetCatalogTimestamp (const shash::Any &catalog, uint64_t *timestamp) const |
void | BeginTransaction () |
void | CommitTransaction () |
void | TakeDatabaseFileOwnership () |
void | DropDatabaseFileOwnership () |
bool | OwnsDatabaseFile () const |
bool | Vacuum () |
std::string | fqrn () const |
std::string | database_file () const |
Static Public Member Functions | |
static Reflog * | Open (const std::string &database_path) |
static Reflog * | Create (const std::string &database_path, const std::string &repo_name) |
static void | HashDatabase (const std::string &database_path, shash::Any *hash_reflog) |
static bool | ReadChecksum (const std::string &path, shash::Any *checksum) |
static bool | WriteChecksum (const std::string &path, const shash::Any &value) |
Protected Member Functions | |
bool | AddReference (const shash::Any &hash, const SqlReflog::ReferenceType type) |
bool | ContainsReference (const shash::Any &hash, const SqlReflog::ReferenceType type) const |
bool | GetReferenceTimestamp (const shash::Any &hash, const SqlReflog::ReferenceType type, uint64_t *timestamp) const |
Private Member Functions | |
bool | CreateDatabase (const std::string &database_path, const std::string &repo_name) |
bool | OpenDatabase (const std::string &database_path) |
void | PrepareQueries () |
This is an object reference log meant to keep track of all "root" objects in the backend storage it is situated in. It's main purpose is to keep track of historic objects for efficient and robust garbage collection.
"Root objects" in this sense are backend objects containing references to other backend objects but that are not necessarily referenced by any other object in the backend. For example historic root catalogs, history databases, meta-info objects or certificates.
Every time such an object is newly added to a backend storage of CernVM-FS its content hash (and object type) will be added to the Reflog. This ensures an authoritative list of "root objects" in a given backend storage.
Reflogs are associated to a specific backend storage of Stratum0 or Stratum1 and not to a CernVM-FS repository. Thus, the Reflogs of Stratum0 and its replicas can and probably will be different and are not interchangeable.
TODO(rmeusel): this shares a lot of database management code with SqliteHistory and (potentially) ...Catalog. This might be an architectural weakness and should be cleaned up.
bool manifest::Reflog::AddCatalog | ( | const shash::Any & | catalog | ) |
Definition at line 128 of file reflog.cc.
Referenced by swissknife::CommandPull::Pull(), SigningTool::Run(), publish::Sync(), and swissknife::RootChainWalker::WalkRootCatalogs().
bool manifest::Reflog::AddCertificate | ( | const shash::Any & | certificate | ) |
Definition at line 121 of file reflog.cc.
Referenced by swissknife::CommandReconstructReflog::AddStaticManifestObjects(), swissknife::CommandPull::Main(), publish::OnProcessCertificate(), and SigningTool::Run().
bool manifest::Reflog::AddHistory | ( | const shash::Any & | history | ) |
Definition at line 134 of file reflog.cc.
Referenced by swissknife::CommandPull::Main(), publish::OnProcessHistory(), SigningTool::Run(), and swissknife::RootChainWalker::WalkHistories().
bool manifest::Reflog::AddMetainfo | ( | const shash::Any & | metainfo | ) |
Definition at line 140 of file reflog.cc.
Referenced by swissknife::CommandReconstructReflog::AddStaticManifestObjects(), swissknife::CommandPull::Main(), publish::OnProcessMetainfo(), and SigningTool::Run().
|
protected |
Definition at line 251 of file reflog.cc.
Referenced by AddCatalog(), AddCertificate(), AddHistory(), and AddMetainfo().
void manifest::Reflog::BeginTransaction | ( | ) |
Definition at line 295 of file reflog.cc.
Referenced by swissknife::CommandGc::Main(), swissknife::CommandReconstructReflog::Main(), swissknife::CommandPull::Main(), and SigningTool::Run().
void manifest::Reflog::CommitTransaction | ( | ) |
Definition at line 301 of file reflog.cc.
Referenced by swissknife::CommandGc::Main(), swissknife::CommandReconstructReflog::Main(), swissknife::CommandPull::Main(), and SigningTool::Run().
bool manifest::Reflog::ContainsCatalog | ( | const shash::Any & | catalog | ) | const |
Definition at line 222 of file reflog.cc.
Referenced by swissknife::CommandCheck::InspectReflog(), and swissknife::RootChainWalker::WalkRootCatalogs().
bool manifest::Reflog::ContainsCertificate | ( | const shash::Any & | certificate | ) | const |
Definition at line 215 of file reflog.cc.
Referenced by swissknife::CommandCheck::InspectReflog().
bool manifest::Reflog::ContainsHistory | ( | const shash::Any & | history | ) | const |
Definition at line 239 of file reflog.cc.
Referenced by swissknife::CommandCheck::InspectReflog(), and swissknife::RootChainWalker::WalkHistories().
bool manifest::Reflog::ContainsMetainfo | ( | const shash::Any & | metainfo | ) | const |
Definition at line 245 of file reflog.cc.
Referenced by swissknife::CommandCheck::InspectReflog().
|
protected |
Definition at line 260 of file reflog.cc.
Referenced by ContainsCatalog(), ContainsCertificate(), ContainsHistory(), and ContainsMetainfo().
uint64_t manifest::Reflog::CountEntries | ( | ) |
Definition at line 146 of file reflog.cc.
Referenced by swissknife::CommandReconstructReflog::Main().
|
static |
Definition at line 32 of file reflog.cc.
Referenced by ServerTool::CreateEmptyReflog(), and publish::CreateRootObjects().
|
private |
std::string manifest::Reflog::database_file | ( | ) | const |
Definition at line 337 of file reflog.cc.
Referenced by ServerTool::FetchReflog(), swissknife::CommandGc::Main(), swissknife::CommandReconstructReflog::Main(), swissknife::CommandPull::Main(), swissknife::CommandCreate::Main(), publish::PushReflog(), and SigningTool::Run().
void manifest::Reflog::DropDatabaseFileOwnership | ( | ) |
Definition at line 313 of file reflog.cc.
Referenced by swissknife::CommandGc::Main(), swissknife::CommandReconstructReflog::Main(), swissknife::CommandPull::Main(), swissknife::CommandCreate::Main(), publish::PushReflog(), and SigningTool::Run().
std::string manifest::Reflog::fqrn | ( | ) | const |
bool manifest::Reflog::GetCatalogTimestamp | ( | const shash::Any & | catalog, |
uint64_t * | timestamp | ||
) | const |
|
protected |
Definition at line 275 of file reflog.cc.
Referenced by GetCatalogTimestamp().
|
static |
Use only once the database was closed.
Definition at line 322 of file reflog.cc.
Referenced by swissknife::CommandCheck::InspectReflog(), swissknife::CommandGc::Main(), swissknife::CommandReconstructReflog::Main(), swissknife::CommandPull::Main(), swissknife::CommandCreate::Main(), publish::PushReflog(), and SigningTool::Run().
bool manifest::Reflog::List | ( | SqlReflog::ReferenceType | type, |
std::vector< shash::Any > * | hashes | ||
) | const |
bool manifest::Reflog::ListOlderThan | ( | SqlReflog::ReferenceType | type, |
uint64_t | timestamp, | ||
std::vector< shash::Any > * | hashes | ||
) | const |
|
static |
Definition at line 17 of file reflog.cc.
Referenced by publish::DownloadRootObjects(), swissknife::CommandCheck::InspectReflog(), and publish::PushReflog().
|
private |
|
inline |
|
private |
Definition at line 110 of file reflog.cc.
Referenced by CreateDatabase(), and OpenDatabase().
|
static |
Definition at line 47 of file reflog.cc.
Referenced by swissknife::CommandGc::Main(), swissknife::CommandListReflog::Main(), swissknife::CommandPull::Main(), swissknife::CommandCheck::Main(), and SigningTool::Run().
bool manifest::Reflog::Remove | ( | const shash::Any & | hash | ) |
void manifest::Reflog::TakeDatabaseFileOwnership | ( | ) |
Definition at line 307 of file reflog.cc.
Referenced by publish::DownloadRootObjects(), swissknife::CommandCheck::InspectReflog(), swissknife::CommandReconstructReflog::Main(), and publish::PushReflog().
|
inline |
Definition at line 79 of file reflog.h.
Referenced by swissknife::CommandGc::Main().
|
static |
Definition at line 64 of file reflog.cc.
Referenced by swissknife::CommandGc::Main(), swissknife::CommandReconstructReflog::Main(), swissknife::CommandPull::Main(), swissknife::CommandCreate::Main(), and SigningTool::Run().
|
private |
Definition at line 107 of file reflog.h.
Referenced by ContainsReference(), and PrepareQueries().
|
private |
Definition at line 104 of file reflog.h.
Referenced by CountEntries(), and PrepareQueries().
|
private |
Definition at line 101 of file reflog.h.
Referenced by BeginTransaction(), CommitTransaction(), CountEntries(), CreateDatabase(), database_file(), DropDatabaseFileOwnership(), fqrn(), ListOlderThan(), OpenDatabase(), OwnsDatabaseFile(), PrepareQueries(), Remove(), TakeDatabaseFileOwnership(), and Vacuum().
|
private |
Definition at line 108 of file reflog.h.
Referenced by GetReferenceTimestamp(), and PrepareQueries().
|
private |
Definition at line 103 of file reflog.h.
Referenced by AddReference(), and PrepareQueries().
|
private |
Definition at line 105 of file reflog.h.
Referenced by ListOlderThan(), and PrepareQueries().
|
private |
Definition at line 106 of file reflog.h.
Referenced by PrepareQueries(), and Remove().