CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
manifest::Reflog Class Reference

#include <reflog.h>

Collaboration diagram for manifest::Reflog:

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 ReflogOpen (const std::string &database_path)
 
static ReflogCreate (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 ()
 

Private Attributes

UniquePtr< ReflogDatabasedatabase_
 
UniquePtr< SqlInsertReferenceinsert_reference_
 
UniquePtr< SqlCountReferencescount_references_
 
UniquePtr< SqlListReferenceslist_references_
 
UniquePtr< SqlRemoveReferenceremove_reference_
 
UniquePtr< SqlContainsReferencecontains_reference_
 
UniquePtr< SqlGetTimestampget_timestamp_
 

Detailed Description

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 authorative 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 interchangable.

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.

Definition at line 38 of file reflog.h.

Member Function Documentation

bool manifest::Reflog::AddCatalog ( const shash::Any catalog)

Definition at line 128 of file reflog.cc.

Referenced by swissknife::CommandPull::Pull(), SigningTool::Run(), publish::SyncImpl(), and swissknife::RootChainWalker::WalkRootCatalogs().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

bool manifest::Reflog::AddReference ( const shash::Any hash,
const SqlReflog::ReferenceType  type 
)
protected

Definition at line 251 of file reflog.cc.

Referenced by AddCatalog(), AddCertificate(), AddHistory(), and AddMetainfo().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

bool manifest::Reflog::ContainsCertificate ( const shash::Any certificate) const

Definition at line 215 of file reflog.cc.

Referenced by swissknife::CommandCheck::InspectReflog().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

bool manifest::Reflog::ContainsMetainfo ( const shash::Any metainfo) const

Definition at line 245 of file reflog.cc.

Referenced by swissknife::CommandCheck::InspectReflog().

Here is the call graph for this function:

Here is the caller graph for this function:

bool manifest::Reflog::ContainsReference ( const shash::Any hash,
const SqlReflog::ReferenceType  type 
) const
protected

Definition at line 260 of file reflog.cc.

Referenced by ContainsCatalog(), ContainsCertificate(), ContainsHistory(), and ContainsMetainfo().

Here is the call graph for this function:

Here is the caller graph for this function:

uint64_t manifest::Reflog::CountEntries ( )

Definition at line 146 of file reflog.cc.

Referenced by swissknife::CommandReconstructReflog::Main().

Here is the call graph for this function:

Here is the caller graph for this function:

Reflog * manifest::Reflog::Create ( const std::string &  database_path,
const std::string &  repo_name 
)
static

Definition at line 32 of file reflog.cc.

Referenced by ServerTool::CreateEmptyReflog(), and publish::CreateRootObjects().

Here is the call graph for this function:

Here is the caller graph for this function:

bool manifest::Reflog::CreateDatabase ( const std::string &  database_path,
const std::string &  repo_name 
)
private

Definition at line 80 of file reflog.cc.

Referenced by Create().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string manifest::Reflog::fqrn ( ) const

Definition at line 331 of file reflog.cc.

Referenced by Open().

Here is the call graph for this function:

Here is the caller graph for this function:

bool manifest::Reflog::GetCatalogTimestamp ( const shash::Any catalog,
uint64_t *  timestamp 
) const

Definition at line 228 of file reflog.cc.

Here is the call graph for this function:

bool manifest::Reflog::GetReferenceTimestamp ( const shash::Any hash,
const SqlReflog::ReferenceType  type,
uint64_t *  timestamp 
) const
protected

Definition at line 275 of file reflog.cc.

Referenced by GetCatalogTimestamp().

Here is the call graph for this function:

Here is the caller graph for this function:

void manifest::Reflog::HashDatabase ( const std::string &  database_path,
shash::Any hash_reflog 
)
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().

Here is the call graph for this function:

Here is the caller graph for this function:

bool manifest::Reflog::List ( SqlReflog::ReferenceType  type,
std::vector< shash::Any > *  hashes 
) const

Definition at line 157 of file reflog.cc.

Here is the call graph for this function:

bool manifest::Reflog::ListOlderThan ( SqlReflog::ReferenceType  type,
uint64_t  timestamp,
std::vector< shash::Any > *  hashes 
) const

Definition at line 165 of file reflog.cc.

Referenced by List().

Here is the call graph for this function:

Here is the caller graph for this function:

Reflog * manifest::Reflog::Open ( const std::string &  database_path)
static

Definition at line 17 of file reflog.cc.

Referenced by publish::DownloadRootObjects(), swissknife::CommandCheck::InspectReflog(), and publish::PushReflog().

Here is the call graph for this function:

Here is the caller graph for this function:

bool manifest::Reflog::OpenDatabase ( const std::string &  database_path)
private

Definition at line 96 of file reflog.cc.

Referenced by Open().

Here is the call graph for this function:

Here is the caller graph for this function:

bool manifest::Reflog::OwnsDatabaseFile ( ) const
inline

Definition at line 76 of file reflog.h.

Here is the call graph for this function:

void manifest::Reflog::PrepareQueries ( )
private

Definition at line 110 of file reflog.cc.

Referenced by CreateDatabase(), and OpenDatabase().

Here is the call graph for this function:

Here is the caller graph for this function:

bool manifest::Reflog::ReadChecksum ( const std::string &  path,
shash::Any checksum 
)
static

Definition at line 47 of file reflog.cc.

Referenced by swissknife::CommandGc::Main(), swissknife::CommandListReflog::Main(), swissknife::CommandCheck::Main(), swissknife::CommandPull::Main(), and SigningTool::Run().

Here is the call graph for this function:

Here is the caller graph for this function:

bool manifest::Reflog::Remove ( const shash::Any hash)

Definition at line 187 of file reflog.cc.

Here is the call graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

bool manifest::Reflog::Vacuum ( )
inline

Definition at line 79 of file reflog.h.

Referenced by swissknife::CommandGc::Main().

Here is the caller graph for this function:

bool manifest::Reflog::WriteChecksum ( const std::string &  path,
const shash::Any value 
)
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().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

UniquePtr<SqlContainsReference> manifest::Reflog::contains_reference_
private

Definition at line 107 of file reflog.h.

Referenced by ContainsReference(), and PrepareQueries().

UniquePtr<SqlCountReferences> manifest::Reflog::count_references_
private

Definition at line 104 of file reflog.h.

Referenced by CountEntries(), and PrepareQueries().

UniquePtr<SqlGetTimestamp> manifest::Reflog::get_timestamp_
private

Definition at line 108 of file reflog.h.

Referenced by GetReferenceTimestamp(), and PrepareQueries().

UniquePtr<SqlInsertReference> manifest::Reflog::insert_reference_
private

Definition at line 103 of file reflog.h.

Referenced by AddReference(), and PrepareQueries().

UniquePtr<SqlListReferences> manifest::Reflog::list_references_
private

Definition at line 105 of file reflog.h.

Referenced by ListOlderThan(), and PrepareQueries().

UniquePtr<SqlRemoveReference> manifest::Reflog::remove_reference_
private

Definition at line 106 of file reflog.h.

Referenced by PrepareQueries(), and Remove().


The documentation for this class was generated from the following files: